Use 'isalnum()' instead:

int isalnum( int c );

int iswalnum( wint_t c );

Each of these routines returns true if c is a particular representation of an alphanumeric character.

Return Value

isalnum returns a non-zero value if either isalpha or isdigit is true for c, that is, if c is within the ranges A – Z, a – z, or 0 – 9. iswalnum returns a non-zero value if either iswalpha or iswdigit is true for c. Each of these routines returns 0 if c does not satisfy the test condition.

int isalnum( int c );

int iswalnum( wint_t c );

Each of these routines returns true if c is a particular representation of an alphanumeric character.

Return Value

isalnum returns a non-zero value if either isalpha or isdigit is true for c, that is, if c is within the ranges A – Z, a – z, or 0 – 9. iswalnum returns a non-zero value if either iswalpha or iswdigit is true for c. Each of these routines returns 0 if c does not satisfy the test condition.