Question: IN C++ You need to write a function named reverse. The function is described below: reverse: takes an array of integers and its size as
IN C++
You need to write a function named reverse. The function is described below: reverse: takes an array of integers and its size as arguments. It reverses the array in place so that the elements are in reverse order. This can be done by swapping the first and last elements, second and second-to-last elements, and so on. Do not use square brackets [] anywhere in the function, not even the parameter list (use pointers instead). Use the main function to demonstrate your function (you may use square brackets in the main function). Assume the input will be a sequence of numbers, the first number will be a count of how many numbers follow. Input the values into the array and call reverse on it. In main it should output the values of the array after the call to the function. Ex: If the input to the program is: 8 1 2 3 4 5 6 7 8 the output is: 8 7 6 5 4 3 2 1 If the input to the program is: 5 1 2 4 3 5 the output is: 5 3 4 2 1 Your program must define and call a function named reverse with two parameters in the order described above, that returns void.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
