Question: Write a function reverse() that reverse the sequence of elements in an array. For example, if reverse() is called with an array containing 1 4

Write a function reverse() that reverse the sequence of elements in an array. For example, if reverse()is called with an array containing

1 4 9 16 9 7 4 9 11

then the array is changed to

11 9 4 7 9 16 9 4 1

reverse() must work with any size array (with, or course, the array size provided as a parameter). Create a program (reverse.cpp) with main() that will test reverse().

Test Cases:

Forward: 1 4 9 16 9 7 4 9 11 Reverse: 11 9 4 7 9 16 9 4 1 Forward: 1 4 9 16 9 7 4 9 11 3 Reverse: 3 11 9 4 7 9 16 9 4 1 Forward: 10 Reverse: 10 Forward: 20 10 Reverse: 10 20

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!