Question: 1 1 . 3 0 LAB; Reverse a string c + + 1 1 . 3 0 LAB: Reverse a string Write a recursive function
LAB; Reverse a string c LAB: Reverse a string
Write a recursive function called ReverseString that takes in a string as a parameter and returns the string in reversed order. The main
function is provided to read a string from the user and call the ReverseString function.
Ex: If the input of the program is:
Heo
the ReverseString function returns and the program outputs:
Reverse of "Hello" is "olleH".
Ex: If the input of the program is:
Hello, world!
the ReverseString function returns and the program outputs:
Reverse of "Hello, world!" is dlrow, olleH".
Hint: Move the first character to the end of the returning string and pass the remaining substring to the next ReverseString function call.
qy
LAB
ACTIVITY
: LAB: Reverse a string
#include
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
