标签:
1 //看EOF的值 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 int main(void) 6 { 7 printf("EOF的值用数字表示为:%d\n", 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\n"); 8 printf("表达式 getchar() != EOF 的值为 %d\n", getchar()!= EOF); 9 system("pause"); 10 return 0; 11 }
结果:Ctrl+D ---> 1 ; Ctrl + Z ---> 0
#include <stdio.h> int main(void) { //注:建议使用标准的转义字符(\n,\t,\b,\",\\之类),如果使用非标准的转义字符,结果将变得不可预期(比如下面的\a,\f,\r,\v 之类) printf("\\Audible or visual alert. \a\n"); printf("Form feed. \f\n"); printf("This escape, \r, moves the active position to the initial position of the current line.\n"); printf("Vertical tab \v is tricky, as its behaviour is unspecified under certain conditions.\n"); return 0; }
#include <stdio.h> int main(void) { printf("EOF的值用数字表示为:%d\n", EOF);return 0; } 结果:-1
标签:
原文地址:http://www.cnblogs.com/tangtang-123/p/4492910.html