Everything
7.4.3 <ctype.h>

Checks and converts character types.

Type

Definition Name

Description

Function

isalnum

Tests for a letter or a decimal digit.

isalpha

Tests for a letter.

iscntrl

Tests for a control character.

isdigit

Tests for a decimal digit.

isgraph

Tests for a printing character except space.

islower

Tests for a lowercase letter.

isprint

Tests for a printing character including space.

ispunct

Tests for a special character.

isspace

Tests for a white-space character.

isupper

Tests for an uppercase letter.

isxdigit

Tests for a hexadecimal digit.

tolower

Converts an uppercase letter to lowercase.

toupper

Converts a lowercase letter to uppercase.

isblank <-lang=c99>

Tests for a space character or a tab character.

 

In the above functions, if the input parameter value is not within the range that can be represented by the unsigned char type and is not EOF, the operation of the function is not guaranteed.

Character types are listed in Table 7.6.

Table 7.6

Character Types

Character Type

Description

Uppercase letter

Any of the following 26 characters

'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'

Lowercase letter

Any of the following 26 characters

'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'

Letter

Any uppercase or lowercase letter

Decimal digit

Any of the following 10 characters

'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'

Printing character

A character, including space (' ') that is displayed on the screen (corresponding to ASCII codes 0x20 to 0x7E)

Control character

Any character except a printing character

White-space character

Any of the following 6 characters

Space (' '), form feed ('\f'), new-line (’\n’), carriage return (’\r’), horizontal tab (’\t’), vertical tab (’\v’)

Hexadecimal digit

Any of the following 22 characters

’0’, ’1’, ’2’, ’3’, ’4’, ’5’, ’6’, ’7’, ’8’, ’9’,
’A’, ’B’, ’C’, ’D’, ’E’, ’F’, ’a’, ’b’, ’c’, ’d’, ’e’, ’f’

Special character

Any printing character except space (’ ’), a letter, or a decimal digit

Blank character

Either of the following 2 characters

Space (’ ’), horizontal tab (’\t’)

 

Implementation-Defined Specifications

Item

Compiler Specifications

The character set inspected by the isalnum, isalpha, iscntrl, islower, isprint, and isupper functions

Character set represented by the unsigned char type (0 to 255) and EOF (-1). Table 7.7 shows the character set that results in a true return value.

 

Table 7.7

True Character

Function Name

True Characters

isalnum

'0' to '9', 'A' to 'Z', 'a' to 'z'

isalpha

'A' to 'Z', 'a' to 'z'

iscntrl

'\x00' to '\x1f', '\x7f'

islower

'a' to 'z'

isprint

'\x20' to '\x7E'

isupper

'A' to 'Z'