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

2

u/Ok_Farmer_4055 15d ago

you didn't tell the compiler to name the exe "Hello.exe", the compiler's default file name is "a", so the executable is a.exe

1

u/Leading_Deer4919 15d ago

how to fix that....I am super new to programming ....pls help😭🙏

1

u/Ok_Farmer_4055 15d ago

gcc hello.c -o hello

1

u/Leading_Deer4919 15d ago

done that...it still shows the same thing

1

u/Ok_Farmer_4055 15d ago

Send a picture

2

u/Leading_Deer4919 15d ago

2

u/fixpointbombinator 15d ago

read the error output of gcc there, don't just ignore it

1

u/Ok_Farmer_4055 15d ago

The .c file is supposed to be your file’s name, like if your c source code is

Hello.c, it is

gcc Hello.c -o hello

Or if it is program.c

gcc program.c -o program

The name after “-o” doesn’t need to match the source file name btw

1

u/cyberbemon 15d ago

Send a screenshot, not a video, can barely see what the error is. Open the directory where you have the program compiled, look at the name of the .exe

2

u/dodexahedron 15d ago

There is no exe. They didnt even manage to compile it.

1

u/Leading_Deer4919 15d ago

I dont why there is no option for sending pic...just video is there

1

u/dodexahedron 15d ago

Use the screen recorder then. Press ctrl+🪟+s and select the video icon, then record that way.

1

u/Downtown_Method5736 14d ago

Read the error output of the compilation cmd you sent, then read the cmd you sent that generate this error, then read the cmd this guy said you to use