What is static memory allocation?

C Programming Language >   Variable in C Language >   static Variable in C  

Long Question

1013


Answer:

  • 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[10];  

The above example creates an array of integer type, and the size of an array is fixed, i.e., 10.


This Particular section is dedicated to Question & Answer only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.