/*将字符串str[]中内含的空格字符找出,并显示空格字符的ASCII码*/
1
2
3
4
5
6
7
8
9
10
11
#include<ctype.h>#include<stdio.h>
main()
{
inti;
charstr[]="123c @# FD\tsP[e?\n";
for(i=0;str[i]!=0;i++)
{
if(isspace(str[i]))
printf("str[%d]isawhite-spacecharacter:%d\n",i,str[i]);
}
}
执行
str[4] is a white-space character:32
str[7] is a white-space character:32
str[10] is a white-space character:9 /* \t */
str[16] is a white-space character:10 /* \n */
isspace
最新推荐文章于 2024-09-05 10:38:14 发布