1 //看EOF的值
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 int main(void)
6 {
7 printf("EOF的值用数字表示为:%d
", EOF);
8 system("pause");
9 return 0;
10 }

1 //验证getchar()!= EOF的值
2
3 #include <stdio.h>
4
5 int main(void)
6 {
7 printf("随便按个键,Ctrl+D或Ctrl+Z代表EOF
");
8 printf("表达式 getchar() != EOF 的值为 %d
", getchar()!= EOF);
9 system("pause");
10 return 0;
11 }
结果:Ctrl+D ---> 1 ; Ctrl + Z ---> 0
#include <stdio.h>
int main(void)
{
//注:建议使用标准的转义字符(
, ,,",\之类),如果使用非标准的转义字符,结果将变得不可预期(比如下面的a,f,
,v 之类)
printf("\Audible or visual alert. a
");
printf("Form feed. f
");
printf("This escape,
, moves the active position to the initial position of the current line.
");
printf("Vertical tab v is tricky, as its behaviour is unspecified under certain conditions.
");
return 0;
}

#include <stdio.h>
int main(void)
{
printf("EOF的值用数字表示为:%d
", EOF);return 0;
}
结果:-1