]> zdv2.bktei.com Git - BK-2023-05.git/blob - src/kr_exercises/ch1/s1.5/getchar_eof_test.c
chore(src/kr):Update comment
[BK-2023-05.git] / src / kr_exercises / ch1 / s1.5 / getchar_eof_test.c
1 /* Desc: Test behavior of "getchar() not equal to EOF"
2 * Usage: name=getchar_eof_test; gcc -o "$name" "$name".c; ./"$name";
3 * Ref/Attrib: [0]: The C Programming Language, 2nd Edition, Section 1.5.1
4 */
5 #include <stdio.h>
6
7 /* Exercise 1-6 solution: Reads a single character. Will display
8 * "output:0" if first character provided is EOF (e.g. "alt+D").
9 * Otherwise, will display "output:1".
10 */
11
12 int main(){
13 int output;
14 output = (getchar() != EOF);
15 printf("output:%d", output);
16 return 0;
17 };
18
19 /* Author: Steven Baltakatei Sandoval
20 * License: GPLv3+
21 */