头文件:ctype.h
语法/原型:
int isAlpha(int c);
参数 c 表示要检测字符或者 ASCII 码。返回值:返回非 0(真)表示 c 是字母,返回 0(假)表示 c 不是字母。
【实例】C语言 isAlpha() 函数判断一个字符串中的字符是否是字母。
#include <stdio.h>#include <ctype.h>int main(){ int i = 0; char str[] = "C++ Java C#"; while (str[i]) { if (isAlpha(str[i])) { printf("%c is Alphabetic\n",str[i]); } else { printf("%c is not Alphabetic\n",str[i]); } i++; } return 0;}运行结果:
C is Alphabetic
+ is not Alphabetic
+ is not Alphabetic
is not Alphabetic
J is Alphabetic
a is Alphabetic
v is Alphabetic
a is Alphabetic
is not Alphabetic
C is Alphabetic
# is not Alphabetic 总结
以上是内存溢出为你收集整理的C语言isalpha()函数:判断一个字符是否是字母全部内容,希望文章能够帮你解决C语言isalpha()函数:判断一个字符是否是字母所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)