4 ms·
This (distinguishing -1 from a character value when char is unsigned) is one of the reasons character literals in C have type int instead of char (C++ changed t
by 634636346 3y ago
This (distinguishing -1 from a character value when char is unsigned) is one of the reasons character literals in C have type int instead of char (C++ changed them to char.) Note the return type of getchar().
- atahanacar 3y ago>fgetc() reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error. >getc() is equivalent to fgetc() except that it may be implemented as a macro which evaluates stream more than once. >getchar() is equivalent to getc(stdin).