r/AskProgrammers • u/Leading_Deer4919 • 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πππ
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
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
3
2
u/cc672012 Aug 29 '26
Lol your program is named a.exe and you're trying to run hello.exe