#include <stdio.h> bool inverse(char *array,char *start,char *end) { char temp; while(start<end) { temp=*start; *start=*end; *end=temp; start++; end--; } } int main() { char str[]="i am student"; char *start=str; char *array=start; char *end=str+11; inverse(array,start,end); start=str; for(int i=0;i<12;i++) { if(*(str+i)==' ' || i==11) { char *endP=str+i; end=endP-1; inverse(array,start,end); start=endP+1; } } }