Question: Program is in C++. Write a program that prompts the user to enter a number of integer values. From this information, dynamically allocate an array
Program is in C++. Write a program that prompts the user to enter a number of integer values. From this information, dynamically allocate an array large enough to store these values. In a loop, prompt the user to enter each value and store them in the array.
Implement a function named printArray, that accepts an int array (as a pointer) and the array's size as arguments. This function should print all the values (elements) of the array inside [ ] with commas separating each value. For example the array (with values 1 2 3 4 5) would be printed to the console as [1, 2, 3, 4, 5]
Next, write a function that accepts an int array (as a pointer) 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 (e.g. in the int main () function).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
