C Reference Decimal Digit Test: isdigit()

The function isdigit() returns a non-zero if its argument is a digit between 0 and 9. If its argument is not a digit between 0 and 9, then zero is returned.

isdigit() source code example:


int main()
	char a;
	scanf( "%c", &a );
	if( isdigit(a) )
		printf( "This is a digit: %c\n", a );
		printf( "This is NOT a 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.