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:
#include<stdio.h>
#include<ctype.h>
int main()
{
char a;
scanf( "%c", &a );
if( isdigit(a) )
printf( "This is a digit: %c\n", a );
else
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.
You can leave a response, or trackback from your own site.
Tweet This! or use
to share this post with others.