Practice 1-6 Verify that the value of the expression GetChar ()! = EOF is 0 or 1.
The code is as follows:
#include <stdio.h>//contains information about the standard library. intMain ()//defines a function named Main, which does not accept parameter values. { //Verify that the value of GetChar ()! = EOF is 0 or 1. printf"Verify that the value of GetChar ()! = EOF is 0 or 1. \ n"); printf ("the validation is complete and the result is%d. \ n", GetChar ()! =EOF); Getch (); //prevent the console from flashing through, you need to accept any characters after you close the console. return 0;//returns a shape to the execution environment, and 0 represents a successful execution. }
Personal Understanding:
EOF is defined in header file <stdio.h>, which is an integer number. It does not matter what its specific value is, as long as it is different from any char type.
Symbolic constants are used here to ensure that the program does not need to rely on any of its corresponding specific values.
C Programming language Exercises 1-6