#include <ctype.h>
|
int
isdigit (int c); |
‘‘0’’ ‘‘1’’ ‘‘2’’ ‘‘3’’ ‘‘4’’
‘‘5’’ ‘‘6’’ ‘‘7’’ ‘‘8’’ ‘‘9’’ |
|
#include<ctype.h> //isdigit() #include<stdio.h> //printf() void test_isdigit() { int arr[]={’8’,0xe1,’5’,’Z’,0xfd}; int i = 0; int size = 5; for( i=0; i<size; i++) { int ret = isdigit(arr[i]); //call to the API with chars in arr[] if( (!ret) != 0 ) { printf("\n%c is not a digit", arr[i]); } else { printf("\n%c is a digit", arr[i]); } } printf("\n"); }
Output
8 is a digit á is not a digit 5 is a digit Z is not a digit ý is not a digit
© 2005-2007 Nokia |