Question: In C Please 8.8 Lab Exercise: Pointers, functions, malloc Write and debug your code in Visual Studio, and upload Source.cpp for checking (n) write a
8.8 Lab Exercise: Pointers, functions, malloc Write and debug your code in Visual Studio, and upload Source.cpp for checking (n) write a function that accepts and returns char array pointers char "revstr(char "str) The function should create a new copy of the Cstring str.,in reverse. Remember, to allocate a (char) array inside the function, you must call malloc0 from the stdlit. Your function revstr) must return a pointer to the new Cstring it should not use braces, only pointer notation ", to access the Cstrings Be sure it correctly handies the case of a single character input (2) Demonstrate the function in a maino program which prompts the user to enter strings untl the string is 'quit, and print out the reversed strings. Use fgets0 to read the string, so it may include whitespace Be sure main) also frees the new string memory each time through the loop, to avoid memory leaks Example Enter a string and hit ENTER, Enter "quit" to quit: Hello there In reverse: ereht olleR Enter a string and hit EwTERnt"ustc" to qule: qult ACTIVTY 88.1: Lab Exercise Pointers, functions, malloco Submission Instructions LAB 0 /4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
