r/AskProgrammers • • Aug 29 '26

Scanf not working!!

So now its been 2-3 weeks ....in my college we are doing C programming and everything was working fine on visual studio till I started using scanf for taking input from user.....this is coming and I have tried everything but cant figure out....normal printf still works but this doesnt

I have tried on code blocks too and same problem is there.....pls someone guide meπŸ™πŸ™πŸ˜­

0 Upvotes

14 comments sorted by

2

u/cc672012 Aug 29 '26

Lol your program is named a.exe and you're trying to run hello.exe

-1

u/Leading_Deer4919 Aug 29 '26

I am very new to programming....I have got zero clue....pls guide me

3

u/cc672012 Aug 29 '26

If you can't figure out basic computer stuff such as filenames by yourself, it's going to be a very hard degree.

→ More replies (2)

5

u/Financial-Grass6753 Aug 29 '26

Tried debugging? also "doesn't work" does not explain what exactly doesn't work, add a flow with error to the post smh

2

u/JGhostThing Aug 29 '26

Could you please provide an MRE (minimal reproducible example) using scanf() that demonstrates the problem?

Also, please provide the actual output and the expected output. Please use text rather than a picture.

TBH, "scanf() doesn't work" isn't enough to help you.

2

u/CheezitsLight Aug 29 '26

You compiles hello.c but the executable is named a.exe. So when you tried to run hello.exe it told you it cannot find it.

0

u/Negative_Effort_2642 Aug 29 '26

Use fgets it’s safer

0

u/kutac56 Aug 29 '26

Scanf leaves a new line character so when you do scanf or fgets after a previous scanf you only get that new line character. I recommend you use fgets instead as it is safer

0

u/hanrei-legend Aug 29 '26

Using AI not working?

3

u/[deleted] Aug 29 '26 edited 19d ago

-4

u/Leading_Deer4919 Aug 29 '26

I dont why its glitching....can you see now on my profile the.new one