Tag: The contents of a character array are: "Student a Am I" please change the contents of the array to "I am a student".
#include <stdio.h>//#include <assert.h>void my_reverse (char *left ,char * right) { //assert (left); //assert (right); is null for handling pointer functions, guaranteeing a valid while (left < right) { char tmp = *left; //reverse with intermediate variables *left = *right; *right = tmp; left ++; Right --; }}int my_strlen (CHAR&NBSP;*STR)//Get the array length definition to find the function of string length { int count = 0; while (*str++) { count ++; } return count; // Returns the specified value of Count point int}void reverse (char arr[]) //char *arr{ char *pstart = arr; char *pend = arr + my_strlen (arr) -1; //Note array starting from 0 char *pcur = null; if ((arr == null) | | (arr[0]== ')) //empty array or array end, do not process { &nbsP;return ; } my_reverse (pstart,pend); //inverse entire array while (*arr)// Not NULL, for the case of ' { pcur =arr; //' array start address while (*arr != ' && *arr != ' ') //inside the word { arr++; } pend =arr - 1; //back a my_reverse (pcur, pend); //the word if (*arr == ' ') that encounters a space is followed by a word { // arr++; } }}int main () { char arr[] = "Student a am i "; //idea: The string is reversed first, and then encountered in the space to reverse the word reverse (arr); printf ("%s\n ", ARR); return 0; }
650) this.width=650; "title=" capture. PNG "src=" http://s3.51cto.com/wyfs02/M00/75/45/wKiom1Y0Pf-Cth4SAADIeoaWUZc883.jpg "alt=" Wkiom1y0pf-cth4saadieoawuzc883.jpg "/>
"Interview frequently" C language: Input: "Student A Am I", output "I am a student, cannot use library function