原型:int isalpha(int ch) (另外的俩个函数格式和这个一样)
用法:头文件加入#include <cctype>(C语言使用<ctype.h>
功能:判断字符ch是否为英文字母,当ch为英文字母a-z或A-Z时,在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,返回非零值(
不一定是1),否则返回零。
#include<stdio.h>
#include<ctype.h>//string.h不行
#include <conio.h>//getch()
int main()
{
char ch='K';
printf("%d\n",isalpha(ch));//返回一个非零值,不确定 ,alpha是希腊的第一个字母
getch();
}
isdigit
原型:extern int isdigit(char c);
用法:#include <ctype.h>
功能:判断字符c是否为数字
说明:当c为数字
0-9时,返回非零值,否则返回零。
附加说明 此为宏定义,非真正函数。