Question: C++ Trying to write a function to reverse an array using pointers Reverse in place. Do not use a second array. Test this function using

C++

Trying to write a function to reverse an array using pointers

Reverse in place. Do not use a second array.

Test this function using a dynamic array. Do not forget to delete the dynamic array when you are done.

This what i have so far

1.Take two pointers front and rear where front is pointing to first char of string and rear is pointing to last char of string.

2.Check if front is less than rear

3.If yes, swap the value of first and last character. If no , just print the string.

4.Increment front pointer and decrement rear pointer

Repeat .

char *Reverse(Char *s);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!