Question: LAB ACTIVITY 1 4 . 2 0 Arrays and Pointers Write a C + + program that uses a method called shiftRight that takes in

LAB
ACTIVITY 14.20 Arrays and Pointers
Write a C++ program that uses a method called shiftRight that takes in an int pointer (to an array ) as a parameter. It should shift all the
elements of the array to the right and the last elements should be wrapped around and go to first.
Use pointer arithmetic to traverse the array inside the method and use array notation to print out the resulting
array in the main program.
Add another function called reverse that takes an int pointer (to an array) as a parameter. It should reverse elements of the array.
This function uses array notation to traverse the array and pointer notation to print the results in the main program
You may declare and use helper arrays inside the functions.
The UI will be like this:
12345
Your output
The Original Array
1
2
3
4
5
The Reversed Array
5
4
3
2
1
The Shifted Array
1
5
4
3
2
LAB ACTIVITY 1 4 . 2 0 Arrays and Pointers Write

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!