c 头文件<ctype.h>(二)

测试<ctype.h>函数

 1 #include <stdio.h>
 2 #include <ctype.h>
 3 
 4 int main(){
 5     
 6     int num = 0;
 7     for(int i = 0; i < 256; ++i){
 8         if(isalnum(i)){
 9             printf("%d	'%c'	", i, i);
10             ++num;
11         }
12         if(num == 4){
13             num = 0;
14             puts("");
15         }
16     }
17     puts("");
18     return 0;
19 }

显示结果

 1 #include <stdio.h>
 2 #include <ctype.h>
 3 
 4 int main(){
 5     
 6     int num = 0;
 7     for(int i = 0; i < 256; ++i){
 8         if(isalpha(i)){
 9             printf("%d	'%c'	", i, i);
10             ++num;
11         }
12         if(num == 4){
13             num = 0;
14             puts("");
15         }
16     }
17     puts("");
18     return 0;
19 }

 1 #include <stdio.h>
 2 #include <ctype.h>
 3 
 4 int main(){
 5     
 6     for(int i = 0; i < 256; ++i){
 7         if(isdigit(i)){
 8             printf("ASCII=%d	'%c'
", i, i);
 9         }
10     }
11     return 0;
12 }

原文地址:https://www.cnblogs.com/xuqiulin/p/5559934.html