diff options
author | zlg <zlg@zlg.space> | 2013-02-07 02:52:52 -0600 |
---|---|---|
committer | zlg <zlg@zlg.space> | 2013-02-07 02:52:52 -0600 |
commit | 9ff9f305ff7059681d691d750582e6259cd90b59 (patch) | |
tree | e715b7954f93cd217d3f3f59fdfb029596085b20 /1-06_eof-test.c | |
parent | Fix style issue and correct 1-24 (diff) | |
download | knr-9ff9f305ff7059681d691d750582e6259cd90b59.tar.gz knr-9ff9f305ff7059681d691d750582e6259cd90b59.tar.bz2 knr-9ff9f305ff7059681d691d750582e6259cd90b59.tar.xz knr-9ff9f305ff7059681d691d750582e6259cd90b59.zip |
Solve Exercises 1-1 to 1-12
It was bugging me and the exercises are simple, so I pumped'em out.
Diffstat (limited to '')
-rw-r--r-- | 1-06_eof-test.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/1-06_eof-test.c b/1-06_eof-test.c new file mode 100644 index 0000000..5214338 --- /dev/null +++ b/1-06_eof-test.c @@ -0,0 +1,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; +} |