From WikiChip
<ctype.h> Header - C
< c
Revision as of 12:12, 4 January 2015 by Inject (talk | contribs) (Inject moved page Ctype.h - C to c/ctype.h)


The <ctype.h> header is part of the standard library of the C programming language that declares several functions useful for classifying and mapping characters.

Some of the functions in this header are local-specific. That is, depending on the locale chosen, some functions behave slightly differently. The minimum locale that must be provided is the "C" locale.

Functions

All functions in this header take a single argument of type int which should be representable as an unsigned char or be equal to the value of the macro EOF. All other values result in undefined behavior.

Functions in this header falls under two categories:

Character classification functions

Function Prototype Description Since
int isalnum(int c); Checks if c is alphanumeric. C89
int isalpha(int c); Checks if c is alphabetic. C89
int isblank(int c); Checks if c is blank. C99
int iscntrl(int c); Checks if c is a control character. C89
int isdigit(int c); Checks if c is a decimal digit. C89
int isgraph(int c); Checks if c has a graphical representation. C89
int islower(int c); Checks if c is a lowercase letter. C89
int isprint(int c); Checks if c is printable. C89
int ispunct(int c); Checks if c is a punctuation character. C89
int isspace(int c); Checks if c is a white-space character. C89
int isupper(int c); Checks if c is an uppercase letter. C89
int isxdigit(int c); Checks if c is a hexadecimal digit. C89

Character case mapping functions

Two functions that deal with character case mapping is provided.

Function Prototype Description Since
int tolower(int c); Converts an uppercase letter to a corresponding lowercase letter. C89
int toupper(int c); Converts a lowercase letter to a corresponding uppercase letter. C89