The thing is that when you press [Enter] in the standard input stream, except for the characters you type, the line feed character ('\ n') is entered. getchar () reads it and the program does not wait for the next [Enter], what you apparently want.
Actually, in your case ( I think this is a console in Windows ), call (as already answered @Tim and @gecube ) getch () . This function waits for pressing a character on the keyboard and returns its code. This character is not entered (!) Into the standard input stream and moreover, even if it ^ Z does not close the stream (you will not receive EOF in this case).
kbhit () polls the keyboard without waiting ("processor is eating") and returns 0 if no key is pressed and 1 (not the code of the entered character!) if something is pressed. The key code is placed at the end of the standard input stream.
I hope this information will be useful to you when programming input from the console.