aboutsummaryrefslogtreecommitdiff
path: root/ch1/1-06_eof-test.c
blob: 5214338012ada2b175a86978a18be979186e4b26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>

/* The C Programming Language, 2nd Edition
 *
 * Exercise 1-6: Verify that the expression 'getchar() != EOF' is 0 or 1.
 *
 * Answer: Easy.
 */

int main(void) {
	int c;
	c = (getchar() != EOF);
	printf("%d\n", c);
	return 0;
}