码迷,mamicode.com
首页 > 其他好文 > 详细

isalpha (int c)检查参数c是否为英文字母

时间:2014-09-27 01:48:39      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   使用   ar   for   sp   div   

/*义函数    int isalpha (int c)
函数说明    检查参数c是否为英文字母,在标准c中相当于使用 (isupper(c)||islower(c))做测试。
返回值    若参数c为英文字母,则返回TRUE,否则返回NULL( 0 )。
附加说明    此为宏定义,非真正函数

范例*/
/* 找出str 字符串中为英文字母的字符*/    
#include<ctype.h>
#include<stdio.h>
void main()
{
  char str[]="123c@#FDsP[e?";
  int i;
 for (i=0;str[i]!=0;i++ )
  if ( isalpha(str[i])) printf("%c is an alphanumeric character\n",str[i]);
}
/*执行    
c is an apphabetic character
F is an apphabetic character
D is an apphabetic character
s is an apphabetic character
P is an apphabetic character
e is an apphabetic character*/

 

isalpha (int c)检查参数c是否为英文字母

标签:style   blog   color   io   使用   ar   for   sp   div   

原文地址:http://www.cnblogs.com/leijiangtao/p/3995725.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!