将一句话中每个单词前后翻转
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char arr[500] = "0";
gets(arr);
int i = 0, j = 0,o=0;
int len = strlen(arr);
arr[len] = ' ';
for (i = 0; i <=len ; i++)
{
if (arr[i] == ' ')
{
o = i;
int w;
for (w=0;w<j;w++)
{
printf("%c",arr[--o]);
}
printf(" ");
j = 0;
continue;
}
j++;
}
return 0;
}
--o与continue都要注意
标签:arr,int,len,单词,--,printf,include,翻转 From: https://blog.51cto.com/u_15841666/5889047