 | | All of these functions use variables of type int to hold byte values, rather than type char. This is necessary to allow the functions to return the constant EOF, which is usually defined as -1. If the char type were used instead of int, then reading a character with decimal value 255 could erroneously cause a program to think end-of-file had been reached, because the char value -1 can get sign-extended to the int value -1 during comparisons. For this reason, it is important to always use variables of type int when working with these functions. | |
|