Question
A.Reverse Array Write a function that accepts an int array and the arrays size as arguments. The function should create a copy of the array,
A.Reverse Array Write a function that accepts an int array and the arrays size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer to the new array. Demonstrate the function in a complete program.
B. Array Expander:
Write a function that accepts an int array and the array s size as arguments. The
function should create a new array that is twice the size of the argument array. The
function should copy the contents of the argument array to the new array, and initialize
the unused elements of the second array with 0. The function should return a
pointer to the new array.
C. Element Shifter
Write a function that accepts an int array and the array s size as arguments. The
function should create a new array that is one element larger than the argument array.
The rst element of the new array should be set to 0. Element 0 of the argument array
should be copied to element 1 of the new array, element 1 of the argument array
should be copied to element 2 of the new array, and so forth. The function should
return a pointer to the new array.
Programming language: C++
Make sure to declare and initialize the original array inside of main AND THEN call a function to reverse the array and then call another function to expand the array and then call a third function to shift the array. The functions to reverse, expand and shift have to be separate. Each function will return a pointer to the new array that was generated. Main will then call a displayArray function (3 separate times) to display each new array. Here's how d like it organized: prototypes mainO declare array declare the pointers reversePointer -reverseArray(array, SIZE) expandPointer expandArray(array, SIZE) shiftPointer shiftArrayarray, SIZE) displayArray(reversePointer, SIZE) displayArray(expandPointer, SIZE) displayArray(shiftPointer, SIZE) You cannot just display the dynamically-created arrays in the functions that created them. You MUST display the arrays after the functions have returned their pointer to main. To help us grade, let's initialize the firstArray to 3,6,9,12,15,18,21,24,27,30Step 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