ctype.h既支持单字节(Byte)字符,也支持宽字符;是C标准函数库中的头文件,定义了一批C语言字符分类函数(C character classification functions),用于测试字符是否属于特定的字符类别,如字母字符、控制字符等。
isdigit
函数名称: isdigit
函数原型: int isdigit(char ch);
函数功能: 检查ch是否是数字(0-9)
函数返回: 是返回非0,否则返回0
参数说明:
所属文件: ctype.h
include
include
intmain()
{
charch1='1';
charch2='a';
if(isdigit(ch1)!=0)
printf("%cistheASCIInumber\n",ch1);
else
printf("%cisnottheASCIInumber\n",ch1);
if(isdigit(ch2)!=0)
printf("%cistheASCIInumber\n",ch2);
else
printf("%cisnottheASCIInumber\n",ch2);
return0;