beautypg.com

Character handling

Page 341

background image

UM014423-0607

C Standard Library

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

321

Macro

Character Handling

The <

ctype.h

> header declares several macros and functions useful for testing and map-

ping characters. In all cases, the argument is an

int

, the value of which is represented as

an

unsigned char

or equals the value of the EOF macro. If the argument has any other

value, the behavior is undefined.

Macros

NOTE: These are nonstandard macros.

Functions

The functions in this section return nonzero (true) if, and only if, the value of the argument
c conforms to that in the description of the function. The term printing character refers to
a member of a set of characters, each of which occupies one printing position on a display
device. The term control character refers to a member of a set of characters that are not
printing characters.

Character Testing

assert(expression);

Tests the expression and, if false, prints the diagnostics including the
expression, file name, and line number. Also calls exit with nonzero exit
code if the expression is false.

TRUE

Expands to a constant 1.

FALSE

Expands to a constant 0.

int isalnum(int c);

Tests for alphanumeric character.

int isalpha(int c);

Tests for alphabetic character.

int iscntrl(int c);

Tests for control character.

int isdigit(int c);

Tests for decimal digit.

int isgraph(int c);

Tests for printable character except space.

int islower(int c);

Tests for lowercase character.

int isprint(int c);

Tests for printable character.

int ispunct(int c);

Tests for punctuation character.

int isspace(int c);

Tests for white-space character.

int isupper(int c);

Tests for uppercase character.

int isxdigit(int c);

Tests for hexadecimal digit.

This manual is related to the following products: