程序代码:#include<stdio.h>
#include<string.h>
int _fun(char *str)
{
char *p1, *p2;
p1 = str;
p2 = p1;
while(*p2)
{
if(*p2 != ' ')
{
*p1 = *p2;
p1++;
}
p2++;
}
*p1 = '\0';
}
int main()
{
char str[100];
while(1)
{
printf("输入字符串:");
gets(str);
if(!*str) break;
_fun(str);
printf("%s\n", str);
}
return 0;
}
[此贴子已经被作者于2016-4-23 16:10编辑过]

