Preview:
#include <stdio.h> int strlen_t(char* s, char t) { int l; for(l=0; s[l]!=t && s[l]!='\0'; ++l){} return l; } int reverse(char* s, char t) { int l = strlen_t(s, t), i; for(i=0; i<l/2; ++i) { t=s[i]; s[i]=s[l-1-i]; s[l-1-i]=t; } return l; } int main() { char a[200]="Reverse this sentence by word"; int l, lsum; l = reverse(a, '\0'); for(lsum=0; lsum<l; ) { lsum+=(reverse(a+lsum,' ')+1); } printf("%s\n",a); return 0; }