Question: Consider the following function reverse, that attempts to reverse an array in place (i.e. without the use of additional storage). It does it by interchanging
Consider the following function reverse, that attempts to reverse an array in place (i.e. without the use of additional storage). It does it by interchanging the first and last elements, then the second and second from last etc. All of the interchanges are done by calling function interchange. Here are the two functions and a main program:
(SEE ATTACHMENT)
-
When I run the program, I expect to see the output reverse the array, but it doesnt. Why?
-
What very simple change will fix it (so the program will print 3, 2, 1, ) and explain your change.
#include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
