Student A am I is flipped into I am a student.
Method:
(1) First Flip all the strings, which becomes "I ma a tneduts",
(2) When the space is encountered, the space before the paragraph of the character is flipped, and then down judgment.
#include <stdio.h>#include <string.h>#include <assert.h>Char* Fanzhuan (Char*Str) {ASSERT (Str);Char*l =Str;Char*r =Str; while(*r! =' + ') {r++; } while(L < R1) {CharTMP = *L; *l = * (r1); * (r1) = tmp; l++; r--; } L =Str; R =Str; while(*r! =' + ') { while(*r! = +&& *r! =' + ') {r++; }Char*p = R; while(L < R1) {CharTMP = *L; *l = * (r1); * (r1) = tmp; l++; r--; }if(*p = =' + ') {return Str; } L = p+1; r = p+1; }return Str;}intMain () {CharA[] ="Student A Am I";Char*ret = Fanzhuan (a); printf"%s\n", ret);return 0;}
Better code The individual has not come up with a need to improve.
The
C language flips student A am I into the I am a student.