Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
oorrja
GitHub Repository: oorrja/learntosolveit
Path: blob/master/languages/cprogs/Ex_1.6_verifyeof.c
1240 views
1
/**
2
* Exercise 1.6 - Verify that the expression getchar() != EOF is 0 or 1
3
*
4
**/
5
6
#include<stdio.h>
7
8
int main(int argc, char *argv[]) {
9
int c;
10
11
while ((c = getchar()) != EOF) {
12
printf("%d ", c != EOF);
13
putchar(c);
14
}
15
16
printf("\n%d\n", c != EOF);
17
18
}
19
20