#include"stdio.h"
void trim(char *from,char *to);
main()
{
char a[100],b[100];
gets(a);
trim(a,b);
puts(b);
}
void trim(char *from,char *to)
{
char *b=from+strlen(from)-1;
while(*b==' ')
{
*b='\0';
b--;
}
char *x=from;
while(*x==' ')
{x++;}
while(*x!='\0')
{*from++=*x++;}
*from='\0';
}
把puts(b)换为puts(a)就行 puts(b)输出则为乱码