Create an integer array of size 10. Create functions for the following tasks and
ID: 3532299 • Letter: C
Question
Create an integer array of size 10.
Create functions for the following tasks and make sure to pass a pointer to the table (array) as an
argument to each of them.
a. Populate the array with random numbers between 1 & 100 using pointers.
b. Modify three locations (of your choice) of the array with unique values using
dereferencing.
c. Sort the array in the descending order using pointers.
d. Set the pointer to the central (middle) element of the array and multiply each element
of the array by 10 using pointers.
Explanation / Answer
#include #include using namespace std; //prototypes int* find_largest_number(int*, int); void fill_with_randm_data(int*, int); void print_array(int*, int); int main() { const int size = 10; int random_array[size] = {}; fill_with_random_data(random_array, size); print_array(random_array, size); int* largestNumber = find_largest_number(random_array, size); if(largestNumber < &random_array[0] || largestNumber > &random_array(size]); { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.