Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 546 Bytes

exercise1-6.md

File metadata and controls

24 lines (18 loc) · 546 Bytes

Exercise 1-6

Verify that the expression getchar() != EOF is 0 or 1.

Process

Used CRTL + Z to type EOF character which looks like this: ^Z

Final Code

#include <stdio.h>

int main(){
  int value = getchar() != EOF;
  printf("%d", value);
}

Output

Ran program twice. First time input a random character which returns true. Second time input EOF character value, which returns false.

output for exercise1-6

Back to Main