getchar()和scanf("%c")的功能都是从STDIN读一个字符,单论功能两者没有区别. 但两者的返回值是有区别的: ------------------------------------------------ scanf()的详尽介绍请移步这里. ------------------------------------------------- scanf()的返回值的含义是: On success, the function returns the number of…
#include <stdio.h> void main() { int c; c=getchar(); while(c!=EOF) { putchar(c); c=getchar(); } } getchar() returns a distinctive value when there is no more input, a value that cannot be confused with any real character. This value is calledEOF, fo…