Previous Page
Next Page


Ascertains whether a given character is alphanumeric

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

The function isalnum( ) tests whether its character argument is alphanumeric; that is, whether the character is either a letter of the alphabet or a digit. In other words, isalnum( ) is true for all characters for which either isalpha( ) or isdigit( ) is true.

Which characters are considered alphabetic or numeric depends on the current locale setting for the localization category LC_CTYPE, which you can query or change using the setlocale( ) function.

If the character is alphanumeric, isalnum( ) returns a nonzero value (that is, true); if not, the function returns 0 (false).


See the example for isprint( ) in this chapter.

See Also

isalpha( ), isblank( ), iscntrl( ), isdigit( ), isgraph( ), islower( ), isprint( ), ispunct( ), isspace( ), isupper( ), isxdigit( ); the corresponding C99 function for wide characters, iswalnum( ); setlocale( )

Previous Page
Next Page