Name

isdigit

Synopsis

Ascertains whether a given character is a decimal digit

#include <ctype.h>
intisdigit( int c );

The function isdigit() tests whether its character argument is a digit. isdigit() returns a nonzero value (that is, true) for the ten characters between '0' (not to be confused with the null character, '\0') and '9' inclusive. Otherwise, the function returns 0 (false).

Example

See the example for isprint() in this chapter.

See Also

The corresponding C99 function for wide characters, iswdigit(); isalnum(), isalpha(), isblank(), iscntrl(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), setlocale()

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.