Right here waiting for you! -> you! for waiting here Right
代码1:
1 //将字符串反转,但单词不倒置。
2
3 #include<stdio.h>
4 #include<string.h>
5
6 void reverse(char *s)
7 {
8 char data[255][255];//将s中的空格和非空格子串进行存储
9 int row = 0,column = 0;
10 int i,j,k;
11
12 for(i=0;s[i];)
13 {
14 data[row][column] = s[i];
15 column++;
16
17 //找到了空格子串的开头
18 if(s[i] == ' ')
19 {
20 i++;
21 if(s[i] == ' ')
22 {
23 do
24 {
25 data[row][column++] = s[i++];
26 }while(s[i] == ' ');
27
28 data[row++][column] = '