Program not recognizing getchar() command?

So this has been an issue for months, neither me nor my professor nor my classmates understand why its happpening.

we use Visual Studio (latest version) and when we write "getchar();" before return 0 in the code to pause it, it doesn't pause! I've tried launching the .exe from outside visual studio but it's the same.

Now the strangest part is that if we write "getchar();" two times in a row, it DOES wait for input, and only ONE key stroke too.

This is very very bizarre, anyone have experience with this?

thank you.
Probably because a single character of input (usually a new-line or whitespace) was left in the input-buffer following a previous input operation; the first getchar() would consume that extraneous character and return immediately.

If you provided an example, we'd be able to explain why specifically.
I was writing a long thank you thing, but before submitting I clicked "mark solved" and it bloody deleted it.

so yeah, thanks :3 have a nice day, yeah you were right.
Topic archived. No new replies allowed.