English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The C language <ctype.h> header file declares a set of functions to classify (and convert) individual characters. For example, isupper() checks whether a character is uppercase.
C Standard Library ctype.h The header file provides some functions that can be used to test and map characters.
These functions accept int As a parameter, its value must be EOF or represented as an unsigned character.
If the parameter c meets the described conditions, these functions return non-zero (true). If the parameter c does not meet the described conditions, these functions return zero.
The following lists the functions defined in the header file ctype.h:
Number | Function & Description |
---|---|
1 | int isalnum(int c) This function checks if the character passed is a letter and a number. |
2 | int isalpha(int c) This function checks if the character passed is a letter. |
3 | int iscntrl(int c) This function checks if the character passed is a control character. |
4 | int isdigit(int c) This function checks if the character passed is a decimal digit. |
5 | int isgraph(int c) This function checks if the character passed has a graphic representation. |
6 | int islower(int c) This function checks if the character passed is a lowercase letter. |
7 | int isprint(int c) This function checks if the character passed is printable. |
8 | int ispunct(int c) This function checks if the character passed is a punctuation symbol character. |
9 | int isspace(int c) This function checks if the character passed is a whitespace character. |
10 | int isupper(int c) This function checks if the character passed is an uppercase letter. |
11 | int isxdigit(int c) This function checks if the character passed is a hexadecimal digit. |
The standard library also includes two conversion functions that accept and return an "int"
Number | Function & Description |
---|---|
1 | int tolower(int c) This function converts an uppercase letter to a lowercase letter. |
2 | int toupper(int c) This function converts a lowercase letter to an uppercase letter. |
Number | Character class & Description |
---|---|
1 | Digits Complete set of digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } |
2 | Hexadecimal digits Set { 0 1 2 3 4 5 6 7 8 9 Set { A B C D E F a b c d e f } |
3 | Lowercase letters 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 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 The set of lowercase letters and uppercase letters |
6 | Alphanumeric characters The set of digits, lowercase letters, and uppercase letters |
7 | Punctuation symbol characters Set ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ |
8 | Graphic characters The set of alphanumeric characters and punctuation symbols. |
9 | Space character The set of tab, newline, vertical tab, form feed, carriage return, and space characters. |
10 | Printable characters The set of alphanumeric characters, punctuation characters, and space characters. |
11 | Control characters In ASCII encoding, the octal codes of these characters range from 000 to 037as well as 177(DEL). |
12 | Whitespace characters Including space characters and tab characters. |
13 | Letter characters The set of lowercase and uppercase letters. |