May 2012
Intermediate to advanced
679 pages
16h 56m
English
Q. What is static memory allocation?
A.In our programs, we declare variables. Consider the following declaration:
int a[10] ;
When the program gets compiled, the compiler reserves memory for an array of 10 integers. When the program starts running, this memory is assigned to variable a. The allocation is till the program ends. Hence, it is called static. (No change during program life time!)
This method is very natural and hence good. Does this type of allocation have any disadvantage? Yes. In programs, we use many variables. Hence, during execution of programs, a time comes after which we do not use a particular variable. However, memory is still allocated to it. Unfortunately, this memory cannot be utilized. It ...
Read now
Unlock full access