#include void reverser(char *instr); int main() { char *string; string = (char *)malloc(sizeof(char)*256); printf("Enter your sentence to reverse: "); fgets(string, 256, stdin); printf("Forward: %s\n", string); printf("Backward: "); reverser(string); printf("\n"); } void reverser(char *instr) { char *temp; if ((temp = strchr(instr, ' ')) != NULL) { *temp = '\0'; temp = temp + 1; reverser(temp); } else { temp = strchr(instr, '\n'); *temp = '\0'; } printf("%s ", instr); }