Write a function that implements the reverse order of the words in the string//For example student a am I, reverse after I am a student. #include <stdio.h> #include <string.h> #include <assert.h>void reverse_string (char *left, char *right ) //consecutive string reverse order {char temp;while (right > left) {temp = *left;*left = *right;*right = temp;left++;right--;}} Char *reserve (char *str) {assert (str), char *first = Str;char *last = str + strlen (str)-1;while (*str) {char *part = STR;WH Ile (*str! = ' &&*str! = ') {str++;} Reverse_string (part, str-1); if (*str! = ') {str++;} Elsebreak;} Reverse_string (first, last); return first;} int main () {char p[] = "Student A Am I";p rintf ("%s\n", Reserve (p)); return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
"C" write a function that implements the reverse order of words in a string