Most functions in this library classify ASCII characters, that is, decide whether a given byte represents a letter, or a digit, or a white-space, etc., in ASCII encoding. The argument of each function is not a char but a positive integer or an EOF. Usually, the argument belongs to the interval −1..127.
// File ctype.h. // Interface of the ctype library. /////////////////////////////////////////////////////////// #ifndef _CTYPE_H #define _CTYPE_H /////////////////////////////////////////////////////////// // Section 1 -- Boolean functions /////////////////////////////////////////////////////////// // All the functions in this section return zero to say // "no" and a nonnull integer to say "yes". // The function isspace decides whether the argument // represents a white-space character, that is, a character // from the set \ \t \n \v \f \r. Usage: // if (isspace (c)) ... int isspace (int c); // The function isdigit decides whether the argument is a // decimal digit (0 1 2 3 4 5 6 7 8 9). Usage: // if (isdigit (c)) .... int isdigit (int c); // The function islower decides whether the argument // represents a lowercase letter (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). Usage: // if (islower (c)) .... int islower (int c); // The function isupper decides whether the argument // represents an uppercase letter (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). Usage: // if (isupper (c)) .... int isupper (int c); // The function isalpha decides whether the argument // represents a letter (lowercase or uppercase). Usage: // if (isalpha (c)) .... int isalpha (int c); // The function isalnum decides whether the argument // represents an alphanumeric character (i.e., letter or // decimal digit). Usage: if (isalnum (c)) .... int isalnum (int c); // The function ispunct decides whether the argument // represents a punctuation character (! " # $ % & ' ( ) * // + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~). Usage: // if (ispunct (c)) .... int ispunct (int c); /////////////////////////////////////////////////////////// // Section 1 -- Conversion functions /////////////////////////////////////////////////////////// // The function toupper receives a letter c and returns the // corresponding uppercase letter. Usage: C = toupper (c); int toupper (int c); // The function tolower receives a letter C and returns the // corresponding lowercase letter. Usage: c = tolower (C); int tolower (int C); #endif