办法很多,举一例——
#include
#include "string.h"
int main(int argc,char *argv[]){
char s[]="how old are you",i,j,ln,*p[300];
for(ln=strlen(s),i=0;ifor(i=0;s[i]==' ';i++);
for(p[j=0]=s+i++,j++;iif(s[i]==' ' && s[i+1]!=' ')
p[j++]=s+i+1,s[i]='\0';
}
for(j--;j>=0;printf("%s ",p[j--]));
for(i=0;iif(s[i]=='\0')
s[i]=' ';
printf("\nThe original is:\n%s\n",s);
return 0;
}