Question: Create a new file named array_ptrs.cpp and in this file, write a program that does the following: a. Defines an array of integers called my_ints
Create a new file named array_ptrs.cpp and in this file, write a program that does the following:
a. Defines an array of integers called my_ints with a pre-specified size of 4.
b. Populates my_ints with input data provided by the user c. Defines an array of pointers called my_ptrs of the same size asmy_intsandinitializesthepointersinmy_ptrstopointto corresponding elements of the array my_ints (refer to the initial
state in the example shown below) d. Sort the array of pointers my_ptrs in a way such that the pointer
at index 0 (i.e., the first element of my_ptrs) points to the smallest element in my_ints, the pointer at index 1 points to the next larger element in my_ints, etc. (refer to the State after sorting my_ptrs in the example shown below).
e. Traverse the array my_ptrs and print the values being pointed to by each pointer in this array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
