Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

USING C++ The goal of this problem is to perform operations on an array, without

ID: 3769898 • Letter: U

Question

USING C++

The goal of this problem is to perform operations on an array, without using the “subscript operator”, but just with pointers.

Step 1:
Inside the main function, crate an array of 20 elements, and initialize it with unique random elements. Print the array.

Step 2:

*Write a function “int* ArrayManipulator(int* arrayPoiner, const int size)” . This function receives a pointer to the array created in Step 1.

* Further, inside ArrayManipulator create a new array “ReversedArray” and dynamically allocate memory to this array using new operator with length as “size”.

* Initialize “ReversedArray” with the elements pointed by the arrayPoiner.

* Now, reverse the elements of “ReversedArray” strictly using pointers, you cannot use

subscript operator.

* Return the pointer to “ReversedArray”

Step 3:

Inside the main function, receive the pointer returned in step 2. Print the elements of “ReversedArray” just using the received pointer.

Example:

The initial array elements are: 45, 25, 78, 32, 56, 74, 89, 22

Inside ArrayManipulator
The elements of ReversedArray: 45, 25, 78, 32, 56, 74, 89, 22

Inside main:
The elements of ReversedArray: 22, 89, 74, 56, 32, 78, 25, 45

And can screenshot of output be included?

Explanation / Answer

Program:

Sample output:

Code to copy:

#include<iostream>

using namespace std;

int* ArrayManipulator(int* arrayPoiner, const int size);

int main()

{

     int Array[]={45, 25, 78, 32, 56, 74, 89, 22};

     int aSize=sizeof((Array))/sizeo