CS60 Homework 7 --------------------------- Due: Wed. Oct 15 at 1:00pm For homework 7, the task of the program is to read in a sentence from the user and then make use of a recursive function for printing the sentence in reverse. For example, if the user inputted the following (fictitious) sentence: weirdo. a is teacher the though even science computer of history the in course greatest the is CS60 The program should print out: CS60 is the greatest course in the history of computer science even though the teacher is a weirdo. The program MUST make use of a recursive function (function that recursively calls itself during execution) in order to perform this task. Turnin ------------------- The turnin tag for this assignment is 'hw7' and must include the code, a typescript showing the compilation (with gcc options '-ansi -pedantic') without warnings and the program running with the above sentence (you may replace the adjective 'greatest' with whichever you like, without fear of losing points :). Helpful Hints ------------------- - The recursive function does not need to REARRANGE the string, it must simply print out the string in reverse as it runs. - you can use fgets() (see the manpage) to read a string from the user, you may assume an input string of 256 characters or less: fgets(buf, 256, stdin); - you can use strchr() (see manpage) to locate a char in a string - you can assume every word is separated by a single space - you can modify the input string during the computation for proper execution (insert '\0' characters, remove '\n' character, etc) - read the K&R book on pointer arithmetic. You can do something like this: char *a, *b; a = (char *)malloc(sizeof(char)*32); b = a + 1; - Now 'b' points to the chunk of memory starting at a[1] (31 chars). Sample Output: ----------------------------- [nurmi@localhost hw7]$ gcc hw7.c; ./a.out Enter your sentence to reverse: weirdo. a is teacher the though even science computer of history the in course greatest the is CS60 Forward: weirdo. a is teacher the though even science computer of history the in course greatest the is CS60 Backward: CS60 is the greatest course in the history of computer science even though the teacher is a weirdo. [nurmi@localhost hw7]$