States the advantages and disadvantages of static memory allocation
Answers
Answered by
1
Static allocation:
Advantages:
1. Static allocation is done at compile time when you know the size of the array.
2. The memory size allocated to “data” is static. But it is possible to change content of a static structure without increasing the memory space allocated to it.
3. Global variables are declared “ahead of time,” such as fixed array.
4. Lifetime of Static allocation is the entire runtime of program.
5. It has efficient execution time
Disadvantages:
1. In case more static data space is declared than needed, there is waste of space.
2. In case less static space is declared than needed, then it becomes impossible to expand this fixed size during run time
Advantages:
1. Static allocation is done at compile time when you know the size of the array.
2. The memory size allocated to “data” is static. But it is possible to change content of a static structure without increasing the memory space allocated to it.
3. Global variables are declared “ahead of time,” such as fixed array.
4. Lifetime of Static allocation is the entire runtime of program.
5. It has efficient execution time
Disadvantages:
1. In case more static data space is declared than needed, there is waste of space.
2. In case less static space is declared than needed, then it becomes impossible to expand this fixed size during run time
Similar questions