getchar
This is a standard function that gets a character from the stdin.
getch
This is a nonstandard function that gets a character from keyboard, does not echo to screen.
getche
This is a nonstandard function that gets a character from the keyboard, echoes to screen.
Use getchar if you want it to work on all compilers. Use getch or getche on a system that supports it when you want keyboard input without pressing [Enter].
And note that the return value of all three is int! You need this to properly check for EOF.
getchar从输入流中读取字符,所以要有回车的介入,getchar才能判断出一个流的结束。
getch是直接读取一个键值,敲了键盘他就读取了。