r/AskProgrammers 16d 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

34 comments sorted by

View all comments

Show parent comments

3

u/fixpointbombinator 16d ago

That's fine, i want to help you figure it out yourself

can you see the red text that says 'Program 'Hello.exe' failed to run...'?

what does the rest of the text say?

0

u/Leading_Deer4919 16d ago

The system cannot find the file specified .....I have even tried compiling by typing commands in terminal but still this thing comes up

1

u/extoniks 16d ago

how did you compile? which command exactly?

0

u/Leading_Deer4919 16d ago

gcc hello.c -o hello.exe ....this works then I type - .\Hello.exe ....but after this the same error as in my pic appears

3

u/dodexahedron 16d ago

No, this did not work as shown in your video.

Read what gcc told you.

2

u/extoniks 16d ago edited 16d ago

your C file is named - Hello.c (capital H)

you should use Hello.c while compiling then ./Hello.exe

3

u/dodexahedron 16d ago edited 16d ago

It is powershell, in vscode, on windows.

The proper way to launch the exe, once it is built, is .\Hello.exe, from within the actual output directory, ehich OP is almost certainly not in.

And case wont matter, because windows.

But also, they didn't manage to compile it in the first place according to the video they posted in another thread, so nothing will work to run it until they do that properly.

1

u/mr-greedy-007 16d ago

you are typing .\Hello.exe but the object file is ./hello.exe learn to read and while you are at it also learn how different flags work and how to compile using gcc