Question: Implement a recursive reverseString in C + + function like the one in the pdf ' s videos, but with a twist. You are no
Implement a recursive reverseString in C function like the one in the pdfs videos, but with a twist. You are no longer allowed to print out the last character in s You are, however, allowed to print out the first character in s ie s
First, make one change to the function so that it prints out the first character in s s and then calls ReverseString on s minus the last character. Notice that it doesn't work anymore! It no longer reverses the string. Look at what it does and think about why.
What further changes can you make to the function to fix it In other words, write a recursive function that reverses the string, but you aren't allowed to print out the last character in s You are allowed print out the first character in s Useful string functions:
o ssize returns length of string s
o ssubstrposlen returns the substring of s of length len starting at postion pos zero is first positionQuestion
Implement a recursive reverseString in function like the one in the pdfs videos, but with a twist. You are no longer
allowed to print out the last character in s You are, however, allowed to print out the first character in s ie s
First, make one change to the function so that it prints out the first character in and then calls ReverseString on
minus the last character. Notice that it doesn't work anymore! It no longer reverses the string. Look at what it does and
think about why.
What further changes can you make to the function to fix it In other words, write a recursive function that reverses the
string, but you aren't allowed to print out the last character in s You are allowed print out the first character in s Useful
string functions:
ssize returns length of string s
ssubstrposlen returns the substring of of length len starting at postion pos zero is first position
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
