Question: Define a function named second_half_first that takes an integer array and switches the first half and the second half of the array. For example, calling
Define a function named second_half_first that takes an integer array and switches the first half and the second half of the array. For example, calling the function on array [1,2,3,4,5,6] will change it to [4,5,6,1,2,3]. If the array contains odd number of elements, then the middle element should remain at its original position. For example, calling the function on array (20,5,3,9,6] will change it to [9,6,3,20,5]
Can anyone please write this in c++.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
