Character Functions

For all of these the actual type of the argument is int, but for most purposes you can think of the argument type as char. If the value returned is a value of type int, you must perform an explicit or implicit typecast to obtain a char.

Function Declaration Description Header File
bool isalnum(char); Returns true if its argument satisfies either isalpha or isdigit. Otherwise, returns false. cctype
bool isalpha(char); Returns true if its argument is an upper- or lowercase letter. It may also return true for other arguments. The details are implementation dependent. Otherwise, returns false. cctype
bool isdigit(char); Returns true if its argument is a digit. Otherwise, returns false. cctype
bool ispunct(char); Returns true if its argument is a printable character that does not satisfy isalnum and is not whitespace. (These characters are considered punctuation characters.) Otherwise, returns false. cctype
bool isspace(char); Returns true if its argument is a whitespace character (such as blank, tab, or new line). Otherwise, returns false. cctype
bool iscntrl(char); Returns true if its argument is a control character. Otherwise, returns false. cctype
bool islower(char); Returns true if its argument is a lowercase letter. Otherwise, returns false. cctype
bool isupper(char); Returns true if its argument is an uppercase letter. Otherwise, returns false. cctype
int tolower(char); Returns the lowercase version of its argument. If there is no lowercase version, returns its argument unchanged. cctype
int toupper(char); Returns the uppercase version of its argument. If there is no uppercase version, returns its argument unchanged. cctype