Question: Write a program in C++ that contains code addressing the following: Create an integer array of 1,000 items statically, Create the same large array on

Write a program in C++ that contains code addressing the following:

  1. Create an integer array of 1,000 items statically,
  2. Create the same large array on the run time stack (in a function)
  3. Create the same large array from the heap (dynamic memory).

Call each of the the allocations100,000 times and output the timerequired by each to finish all 100,000 calls. Explain your results. Use clock ticks to measure time as indicated below:

#include

clock_t start = 0, end = 0;

start = clock();

end = clock();

Please provide a sample run.

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 Databases Questions!