#include <ctype.h>
int isdigit( int ch );
如果参数是 0 到 9 之间的数字字符,函数返回非零值,否则返回零值。
#include <stdio.h> #include <ctype.h> int main() { char c1 = 'A'; char c2 = '4'; printf("isdigit(c1) = %d\n", isdigit(c1)); printf("isdigit(c2) = %d\n", isdigit(c2)); return 0; }
输出结果:
isdigit(c1) = 0 isdigit(c2) = 4