Write a program with a function C++ Solution

a) In the main function, define an integer array with five entries and assign values to the entries. Display the entries in the order in which they occur within the array.

b) Pass the array to a function. Within the function, dynamically allocate a new integer array. Programmatically assign the value from the original array to the new array in reverse order such that the first entry in the original array becomes the fifth entry in the new array, the second entry in the original array becomes the fourth entry in the new array, and so on. Display the contents of the new array. Use a pointer to an array when assigning and displaying the contents of the new array. The dynamically allocated array will be deleted.

Powered by