#include
#include
#include
void func(char * arr)
{
int i,len;
char *temp,*pt;
len=strlen(arr);
temp=(char *)malloc(len+2);
*temp=' ';
strcpy(temp+1,arr);
do{
i=0;
pt=temp+strlen(temp);
while(*pt!=' ')
{
i++;
pt--;
}
pt++;
printf("%s ",pt);
pt--;
*pt='\0';
}while(strlen(temp));
putchar('\n');
}
void main()
{
char arr[100];
gets(arr);
puts(arr);
func(arr);
}
在vc6.0下运行正常,你试一下