Question: Create a dynamic array of some arbitrary size using new. Fill the array with data. Then increase the size of the array to store a
Create a dynamic array of some arbitrary size using new. Fill the array with data. Then increase the size of the array to store a higher number of elements, adding the old elements to the newly allocated array. Follow these steps: 1) Create a dynamic array. 2) Create a temp array to store the old array's elements. 3) Copy initial array elements into the temporary array. 4) Delete the initial array. 5) Allocate new array with more space. 6) Initialize new array. 7) Copy elements of temp array into new array. 8) Use the new array to perform some task, such as summing the elements of the array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
