Hızlı yanıt: kod örneği
This is what the specs say:the fgetc() function shall obtain the next byte as an unsigned char converted to an intThe following macro name shall be defined as a negative integer constant expression: EOFAs long as you store the return value in an and not a , it is sufficient to check for because it is guaranteed not to represent a valid character value.Also, in your code, this:should be:The additional parentheses are required because has higher precedence than .
int
char
EOF
while (ch = fgetc(fp) != EOF)
while ((ch = fgetc(fp)) != EOF)
!=
=