标签:over data cti std get ram while stand top
Xx_Introduction
Ax_Application
Bx_Method
1 getchar() //read next character 2 putcahr() //print next character 3 printf() //print next(bunch) character
1 #include<stdio.h>
2
3 int main()
4 {
5 int c;
6
7 c = getchar();
8 while(c != EOF){
9 putchar(c);
10 c = getchar();
11 }
12 }
1 #include<stdio.h>
2
3 int main()
4 {
5 int c;
6
7 while((c = getchar())!= EOF){
8 putchar(c);
9 }
10 }
!= : unequal to. priority overtop assignment(=) EOF:end of file
1 #include <stdio.h>
2
3 int main()
4 {
5 int c;
6
7 while (c = getchar() != EOF){
8 printf("%d\n",c);
9 }
10 printf("%d - at EOF\n",c);
11 return 0;
12 }
if not use bracket,will priority operation EOF,value by 1,if input end or else print "c - at EOF".
1 #include <stdio.h>
2
3 int main()
4 {
5 printf("EOF is %d\n",EOF);
6 return 0;
7 }
character constant EOF is in <stdio.h> file definition,value by -1
C lang:character input and output
标签:over data cti std get ram while stand top
原文地址:https://www.cnblogs.com/enomothem/p/11632748.html