isascii

头文件:#include <ctype.h>

定义函数:int isascii(int c);

函数说明:检查参数c是否为ASCII 码字符,也就是判断c 的范围是否在0 到127 之间。

返回值:若参数c 为ASCII 码字符,则返回true,否则返回NULL(0)。

附加说明:此为宏定义,非真正函数。

举例:判断int i 是否具有对应的ASCII 码字符。
    
    
  1. #include <ctype.h>
  2. main(){
  3. int i;
  4. for(i = 125; i < 130; i++)
  5. if(isascii(i))
  6. printf("%d is an ascii character:%c\n", i, i);
  7. else
  8. printf("%d is not an ascii character\n", i);
  9. }
#include <ctype.h>
main(){
    int i;
    for(i = 125; i < 130; i++)
    if(isascii(i))
        printf("%d is an ascii character:%c\n", i, i);
    else
        printf("%d is not an ascii character\n", i);
}

执行结果:
125 is an ascii character:}
126 is an ascii character:~
127 is an ascii character:
128 is not an ascii character
129 is not an ascii character
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值