Question: C++ Language: write a function that accepts an array of integers and its size as arguments. The function should create a new array that is
C++ Language: write a function that accepts an array of integers and its size as arguments. The function should create a new array that is of half size the argument array (round up the fraction if the size of the argument array is odd). The value of the first element (Element 0) of the new array should be the sum of the first two elements of the argument array (Element 0 and 1). Element 1 of the new array should be the sum of Element 2 and 3 of the argument array, and so forth. If the size of the argument array is odd, then the last element of the new array should be the same as the last element of the argument array. The function should return a pointer to the new array to the main. IN THIS FUNCTION AND THIS FUNCTION ALONE, PLEASE USE POINTER NOTATION (NOT SUBSCRIPTS) to move through elements in the arrays. Before calling this function, display your original array. When the function call is completed, display the new array and the original array. You can use the same functions read_array and print_array as before. Initialize the array with integer random numbers in the range from 10 to 30.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
