Question: ****PLEASE DO THIS PROBLEM IN C++**** Write a function that accepts an int array and the array's size as arguments. The function should create a

****PLEASE DO THIS PROBLEM IN C++****
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. Notes: . The user should be asked for the size of the array, as well as the values for the first array * Please display the array in a similar fashion (i.e. a comma separated list of values with . You will need to have a function with the word "expand" in the name, it should return a In the main function, you should have two integer pointers, one for the input and one created. square brackets on the ends) integer pointer, and have an integer pointer and int for parameters. for the expanded array returned by the function. Sample Output: Enter the size ofthe array: 6 EnterValue 1: 1 EnterValue 2: 2 EnterValue 3: 3 EnterValue 4: 4 EnterValue 5: 5 EnterValue 6: 6 The expanded size array is: [1,2,3,4,5,6, 0,0,0,0,0,0] Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
