Question: ( Dynamic Array Allocation ) Write a program that dynamically allocates an array of integers. The size of the array should be input from a
Dynamic Array Allocation Write a program that dynamically allocates an array of integers. The size of the array should be input from a keyboard. The elements of the array should be assigned values input from the keyboard, and then stored to a file. Then read the elements from that file and display the array elements on the screen. Next, reallocate the memory for the array to half of the current number of elements. Display the arrays remaining values to confirm they match the first half of the original arrays values.
Technology Requirements:
Prompt user to enter size of the array of integers to be dynamically created.
Use Calloc to dynamically allocate array.
Initialize elements of array with userentered data.
Write the array elements to a file.
Read the elements back into an array from the file and display the array elements on screen.
Reallocate to half the original size using realloc and sizeof.
Display array after cutting in half on the screen.
Loop to ask if user wants to enter another array.
If yes, loop to get size and repeat, else end the program.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
