C Standard Library - <ctype.h>
Introduction
The ctype.h header file of the C Standard Library provides functions to test and map characters.
These functions take int as a parameter, whose value must be EOF or representable as an unsigned char.
If the argument c satisfies the condition described, these functions return a non-zero value (true). If the argument c does not satisfy the condition described, these functions return zero.
Library Functions
Below is a list of functions defined in the ctype.h header file:
| No. | Function & Description |
|---|---|
| 1 | int isalnum(int c) <br>This function checks whether the passed character is alphanumeric. |
| 2 | int isalpha(int c) <br>This function checks whether the passed character is alphabetic. |
| 3 | int iscntrl(int c) <br>This function checks whether the passed character is a control character. |
| 4 | int isdigit(int c) <br>This function checks whether the passed character is a decimal digit. |
| 5 | int isgraph(int c) <br>This function checks whether the passed character has a graphical representation. |
| 6 | int islower(int c) <br>This function checks whether the passed character is a lowercase letter. |
| 7 | int isprint(int c) <br>This function checks whether the passed character is printable. |
| 8 | int ispunct(int c) <br>This function checks whether the passed character is a punctuation character. |
| 9 | int isspace(int c) <br>This function checks whether the passed character is a whitespace character. |
| 10 | int isupper(int c) <br>This function checks whether the passed character is an uppercase letter. |
| 11 | int isxdigit(int c) <br>This function checks whether the passed character is a hexadecimal digit. |
The standard library also includes two conversion functions that take and return an "int":
| No. | Function & Description |
|---|---|
| 1 | int tolower(int c) <br>This function converts an uppercase letter to a lowercase letter. |
| 2 | int toupper(int c) <br>This function converts a lowercase letter to an uppercase letter. |
Character Classes
| No. | Character Class & Description | |
|---|---|---|
| 1 | Digits <br>The set of complete digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | |
| 2 | Hexadecimal Digits <br>The set { 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f } | |
| 3 | Lowercase Letters <br>The set { 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 } | |
| 4 | Uppercase Letters <br>The set { 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 } | |
| 5 | Letters <br>The set of lowercase and uppercase letters | |
| 6 | Alphanumeric Characters <br>The set of digits, lowercase letters, and uppercase letters | |
| 7 | Punctuation Characters <br>The set ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ |
| 8 | Graphical Characters <br>The set of alphanumeric characters and punctuation characters | |
| 9 | Space Characters <br>The set of tab, newline, vertical tab, form feed, carriage return, and space characters. | |
| 10 | Printable Characters <br>The set of alphanumeric characters, punctuation characters, and space characters. | |
| 11 | Control Characters <br>In ASCII encoding, these characters have octal codes from 000 to 037, and 177 (DEL). | |
| 12 | Whitespace Characters <br>Includes space and tab characters. | |
| 13 | Letter Characters <br>The set of lowercase and uppercase letters. |