Question: Write a single program that call three functions in C. Have the three functions each create/initialize an array but have one that declares and initialize
Write a single program that call three functions in C. Have the three functions each create/initialize an array but have
one that declares and initialize a large array statically (from data segment), one that declares and initialize the same size array on the stack, and one that creates and initialize the same size array from the heap.
Call each of the subprograms a large number of times (at least 1,000) and output the average time required by each.
Explain your results. For example, what are the trade-offs, in time and space, when the allocation of an arrays occurs in the runtime stack rather than the heap or data/static segment?
By large size we mean > 10000000
Declaring and initialize the arrays via for loop in each function for int i=0; i< SIZE; i++)
array[i]=i;
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
