This section explains the library functions for classifying characters.
For example, isalpha is the function to test for an alphabetic
character. It takes one argument, the character to test, and returns a
nonzero integer if the character is alphabetic, and zero otherwise. You
would use it like this:
if (isalpha (c))
printf ("The character `%c' is alphabetic.\n", c);
Each of the functions in this section tests for membership in a
particular class of characters; each has a name starting with `is'.
Each of them takes one argument, which is a character to test, and
returns an int which is treated as a boolean value. The
character argument is passed as an int, and it may be the
constant value EOF instead of a real character.
The attributes of any given character can vary between locales. See section Locales and Internationalization, for more information on locales.
These functions are declared in the header file `ctype.h'.
islower or isupper is true of a character, then
isalpha is also true.
In some locales, there may be additional characters for which
isalpha is true--letters which are neither upper case nor lower
case. But in the standard "C" locale, there are no such
additional characters.
isalpha or isdigit is
true of a character, then isalnum is also true.
"C" locale, isspace returns true for only the standard
whitespace characters:
' '
'\f'
'\n'
'\r'
'\t'
'\v'
unsigned char value that fits
into the US/UK ASCII character set. This function is a BSD extension
and is also an SVID extension.
Go to the first, previous, next, last section, table of contents.