Why character functions accept int argument instead of char argument?
<ctype.h>
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
Characters and integers are rather tightly knit in C.
When you receive a character from an input stream, it must be able to represent every single character plus the end-of-file symbol.
That means a
chartype won’t be big enough so they use a wider type.The C99 rationale document states:
The standard itself has this to say: