测试<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\t'%c'\t", i, i);
10             ++num;
11         }
12         if(num == 4){
13             num = 0;
14             puts("");
15         }
16     }
17     puts("");
18     return 0;
19 }

显示结果

c 头文件(二)

 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\t'%c'\t", i, i);
10             ++num;
11         }
12         if(num == 4){
13             num = 0;
14             puts("");
15         }
16     }
17     puts("");
18     return 0;
19 }

c 头文件(二)

 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\t'%c'\n", i, i);
 9         }
10     }
11     return 0;
12 }

c 头文件(二)

 

相关文章: