Pointers/Memory Allocation   «Prev 

New Storage Allocation - Exercise

Using storage allocated with new

Objective: Write a function that performs string reversal using storage allocated with new.


Assume that s1 ends up with the reverse of the string s2.
Use new to allocate s1 of length strlen(s2) + 1, which is adequate store of s1.

char* strrev(char*& s1, const char* s2);

Paste the source code of your function below and click the Submit button when you are ready to submit this exercise.