r/AskProgrammers 3d ago

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

4

u/Financial-Grass6753 3d ago

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

1

u/diavelguru 3d ago

Yes the biggest skill you can learn is how to debug and how to use whatever debugger you have available. Itโ€™s immensely helpful for work. And once you know you can pass those skills on to your AI companion so its work can be more robust.

3

u/fixpointbombinator 3d ago

you didnt post your code

-5

u/Leading_Deer4919 3d ago

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

0

u/Negative_Effort_2642 3d ago

Use fgets itโ€™s safer

0

u/kutac56 3d ago

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 3d ago

Using AI not working?

2

u/cc672012 3d ago

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

-1

u/Leading_Deer4919 3d ago

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

3

u/cc672012 3d ago

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

0

u/Leading_Deer4919 3d ago

Atleast help this time buddy

3

u/cc672012 3d ago

I did, didn't I? I told you exactly what's wrong

2

u/JGhostThing 3d ago

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 3d ago

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.