C Reference Hexidecimal Digit Test: isxdigit()

The function isxdigit() returns a non-zero if its argument is a hexadecimal digit. (If the argument is a: a-f, A-F, or 0-9).
If the argument is not a hexadecimal digit, then zero is returned.

isxdigit() source code example:


#include<stdio.h>
#include<ctype.h>

int main()
{
	char a;
	scanf( "%c", &a );
	if( isxdigit(a) )
		printf( "Is a hexadecimal digit : %c\n", a );
	else
		printf( "This is NOT a hexadecimal digit: %c\n", a );
	return 0;
}

This entry was posted in C Reference ctype.h Functions. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed. Tweet This! Tweet This! or use to share this post with others.

Comments are closed.