#include <stdio.h> int main() { int c; while(c = getchar() != EOF) printf("%d\n",c); printf("%d -a EOF",c); return 0; }
c = getchar() != EOF 等价于 c = (getchar() != EOF)
#include <stdio.h> int main() { printf("EOF is %d\n",EOF); return 0; }
输出结果 EOF is -1
EOF定义在头文件<stdio.h>中,是一个整型数