#include <stdio.h>
void fun (char *str)
{
/**********Program**********/
int i=0;char *p=str;
while (*p){if(*p!=' '){str[i]=*p;i++;}p++;}
str[i]='\0';
/*
char b[81];int i=0,j=0;
while(str[i]!='\0'){if(str[i]!=' '){b[j]=str[i];j++;}i++;}
for(i=0;i<j;i++){str[i]=b[i];}
str[i]='\0';
*/
/********** End **********/
}
main()
{
char str[81];
printf("请输入带有空格的字符串:\n");
gets(str);
fun(str);
printf("删除空格后的字符串是: %s\n",str);
}
10-18
2063
11-29
3034
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交