Question: Write a program in C++ that contains code addressing the following: a. Create an integer array of 100,000 items (static binding before compiling) b. Create

Write a program in C++ that contains code addressing the following: 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 //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.

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!