//去掉字符串中的空格//
#include<stdio.h>
int main()
{
char s[1024]=" ";
printf ("please input a string include blank for s \ns = ");
scanf("%[^\n]",s); //只要不是换行就接收存储在s
int r,w;
for(r=0,w=0;s[r];r++)
{
if(s[r] != ' '){
s[w]=s[r] ;
w++ ;
}
}
s[w]='\0'; //完成之后将s[w]加'\0',否则预原来位置的字符会保留下来
printf("the new string is \ns = %s\n",s);
return 0;
}