Question: Please solve the problem 14. (12 pts) Write a function called reverseString(), which uses a Stack to reverse a C string (char ). The string
Please solve the problem 14. (12 pts) Write a function called reverseString(), which uses a Stack to reverse a C string (char "). The string that is to be reversed is passed in as a parameter. The function should reverse the characters in the string (i.e. "cat" becomes "tac") and return a pointer to the reversed string. A second string or array should NOT be used to reverse or store the characters. The Stack supports the following member functions: bool push (char c); // adds c to the top of the stack bool pop (char &c) // removes the character at top of stack and places in // parameter c bool isEmpty : // returns true if stack is empty: false otherwise The function header and Stack object instantiation has been supplied for you below: char reverseString (char pStr) Stack theStack
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
