*Might* an unsigned char be equal to EOF? [duplicate]
问题 This question already has answers here : Can sizeof(int) ever be 1 on a hosted implementation? (8 answers) Closed 5 years ago . When using fgetc to read the next character of a stream, you usually check that the end-of-file was not attained by if ((c = fgetc (stream)) != EOF) where c is of int type. Then, either the end-of-file has been attained and the condition will fail, or c shall be an unsigned char converted to int , which is expected to be different from EOF —for EOF is ensured to be