- C Library - Home
- C Library - <assert.h>
- C Library - <complex.h>
- C Library - <ctype.h>
- C Library - <errno.h>
- C Library - <fenv.h>
- C Library - <float.h>
- C Library - <inttypes.h>
- C Library - <iso646.h>
- C Library - <limits.h>
- C Library - <locale.h>
- C Library - <math.h>
- C Library - <setjmp.h>
- C Library - <signal.h>
- C Library - <stdalign.h>
- C Library - <stdarg.h>
- C Library - <stdbool.h>
- C Library - <stddef.h>
- C Library - <stdio.h>
- C Library - <stdlib.h>
- C Library - <string.h>
- C Library - <tgmath.h>
- C Library - <time.h>
- C Library - <wctype.h>
- C Programming Resources
- C Programming - Tutorial
- C - Useful Resources
C Library - isxdigit() function
The C library isupper() function checks whether the passed character is a hexadecimal digit. Hexadecimal digits include the characters '0'-'9', 'a'-'f', and 'A'-'F'.
This function is a part of the C standard library, defined in the header file <ctype.h>
Syntax
Following is the C library syntax of the isupper() function −
int isxdigit(int c);
Parameters
This function accepts a single parameter −
c − This is the character to be checked, passed as an integer. The character is typically an unsigned char value or EOF.
Return Value
The isxdigit function returns a non-zero value (true) if the character is a hexadecimal digit. Otherwise, it returns zero (false).
Example 1: Checking a Hexadecimal Digit
In this example, 'A' is a valid hexadecimal digit, so isxdigit(c) returns true.
#include <stdio.h>
#include <ctype.h>
int main() {
char c = 'A';
if (isxdigit(c)) {
printf("'%c' is a hexadecimal digit.\n", c);
} else {
printf("'%c' is not a hexadecimal digit.\n", c);
}
return 0;
}
Output
The above code produces following result−
'A' is a hexadecimal digit.
Example 2: Checking a Numeric Character c
Here, the isxdigit() function takes the numeric charachter and checks if it is hexadeciam or not.
#include <stdio.h>
#include <ctype.h>
int main() {
char c = '5';
if (isxdigit(c)) {
printf("'%c' is a hexadecimal digit.\n", c);
} else {
printf("'%c' is not a hexadecimal digit.\n", c);
}
return 0;
}
Output
After execution of above code, we get the following result
'5' is a hexadecimal digit.