What is static memory allocation in C Language?
- In case of static memory allocation, memory is allocated at compile time, and memory can’t be increased while executing the program. It is used in the array.
- The lifetime of a variable in static memory is the lifetime of a program.
- The static memory is allocated using static keyword.
- The static memory is implemented using stacks or heap.
- The pointer is required to access the variable present in the static memory.
- The static memory is faster than dynamic memory.
- In static memory, more memory space is required to store the variable.
- For example:
- int a;
The above example creates an array of integer type, and the size of an array is fixed, i.e., 10.