# include & ltstdio.h & gt
# include & ltconio.h & gt
int main(void)
{
char str【20】= { NULL },temp
int長度= 0;
int first space = 0;
int i=0,j=0,k = 0;
printf(“Please enter:\ n“);
gets(str);
temp = str【0】;
while(temp!='\0')
{
i++;
temp = str【I】;
}
長度= I;
printf(“\ n反向輸出為:\ n“);
for(I =長度-1;我& gt=0;我-)
{
if(str【I】= =‘,‘)
{
first space = I;
j = I+1;
while((str【j】!=‘\ 0‘)& amp;& amp(str【j】!=','))
{
printf(“% c“,str【j】);
j++;
}
printf(“% c“,str【I】);
}
}
for(I = 0;我& ltfirstSpacei++){
printf(“% c“,str【I】);
}
getch();
返回0;
}
正在運行的實例:
請輸入:
我,愛,妳
反向輸出是:
妳,愛,我