The function prototype of isxdigit() is:
int isxdigit( int arg );
It is defined in the <ctype.h> header file.
isxdigit() Parameters
The isxdigit() function takes a single character as a parameter.
Note: In C programming, characters are treated as int values internally.
C isxdigit() Return Value
If the argument passed to isxdigit() is
- a hexadecimal character,
isxdigit()returns a non-zero integer. - a non-hexadecimal character,
isxdigit()returns 0.
Example 1: C isxdigit() function
Output
Result when 5 is passed to isxdigit(): 128 Result when M is passed to isxdigit(): 0
Example 2: Program to Check Hexadecimal Character
Output
Enter a character: f f is a hexadecimal character.