Write a program in C++ that contains code addressing the following: (New code and with detailed steps!) a. Create an integer array of 100,000 items (static binding – before compiling) b. Create the same large array on the run time stack (in a function) c. Create the same large array from the heap (dynamic memory – dynamic binding). Call each of the subprograms 1,000,000 times and output the time required by each to finish all 1,000,000 calls. Which was the faste
Write a
a. Create an integer array of 100,000 items (static binding – before
compiling)
b. Create the same large array on the run time stack (in a function)
c. Create the same large array from the heap (dynamic memory –
dynamic binding).
Call each of the subprograms 1,000,000 times and output the time required by
each to finish all 1,000,000 calls. Which was the fastest?
Here is code for calling time.
#include <time.h>
//in main()
clock_t start = 0, end = 0; //variables
start = clock(); //calls time function stores result in start
end = clock(); // calls time function stores result in end
//display the time by subtracting the start from the end
//displays in clock ticks.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
This doesn't utilize the calling code provided?