isxdigit() function in C

Driving innovation in embedded systems, IoT, and FPGA/SOC development. Delivering cutting-edge solutions, expert technical services, and empowering the tech community.
Using the isxdigit() function in C
The isxdigit() function in C is used to check whether a character is a hexadecimal digit (0-9,a-f,A-F). The function takes a character as input and returns a non-zero value if the character is a hexadecimal digit, or zero if the character is not a hexadecimal digit.
Here is an example of how to use the isxdigit() function:
#include <stdio.h>
#include <stdint.h>
#include <ctype.h>
int32_t main(int32_t argc, char const *argv[])
{
char c = 'a';
int32_t result = isxdigit(c);
if (result > 0x00)
{
printf("The character '%c' is a hexadecimal digit.\n", c);
}
else
{
printf("The character '%c' is not a hexadecimal digit.\n", c);
}
return 0;
}
The isxdigit() function takes a character as input and returns a non-zero value if the character is a hexadecimal digit, or zero if the character is not a hexadecimal digit. In this example, the character 'a' is a hexadecimal digit, so the function will return non-zero and the printf() statement will print the output.
Explore the complete list of functions available in ctype header in C standard library.




