Previous Page
Next Page

isdigit

Ascertains whether a given character is a decimal digit

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

The function isdigit( ) tests whether its character argument is a digit. The results depend on the current locale setting for the localization category LC_CTYPE, which you can query or change using the setlocale( ) function.

In the default locale C, 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( )


Previous Page
Next Page