帮我解释一下if(isalpha(*s1))是什么意思
我在看程序的时候,看到其中有if(isalpha(*s1))这条语句
请问这条语句如何解释,那个isalpha是什么意思?
#include <ctype.h>
int isalpha(int c);
是一个宏定义,检查参数是否为英文字母,在标准c相当于用(isupper(c)||islower(c))作测试
若参数c为英文字母则返回非零值,否则返回0;
示例::
#include<ctpe.h>
int main()
{
char str[] = "123@#FDE?+";
int i;
for (i=0; str[i] != 0; i++)
if (isalpha(str[i])
printf("%c is an alphabetic character\n", str[i]);
return 0;
}
结果::
F is an alphabetic character D is an alphabetic character E is an alphabetic character