char *scut_last_word(char s[]) { int spaces, i = 0; char *sptr = s; while (*sptr != '\0') { if (*sptr == ' ') { spaces++; } sptr++; } sptr = s; //reset a s[0] while (*sptr != '\0') { if (*sptr == ' ') { i++; } if (i == spaces) { *sptr = '\0'; } sptr++; } return s; }