69,373
社区成员
发帖
与我相关
我的任务
分享
char *str="zhang san";
int i=0;
while(i<strlen(str))
{
if(str[i++]==0x20)
{
printf("There is a space!\n");
break;
}
}
//用库函数isspace()可以判断的
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main()
{
char *str="zhang san";
int i;
for(i=0;i<strlen(str);++i)
if(isspace(str[i]))
{
printf("There is a space!\n");
getchar();
return 0;
}
printf("There is no space!\n");
system("pause");
return 0;
}