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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started