Static
Static
Static memory refers to memory allocation Dynamic memory allocation refers to memory
that occurs during the compilation allocation that occurs during the execution or
process. runtime of a program.
The memory in a static memory allocation During the execution of a program, dynamic
cannot be altered while the application is memory allocation allows the memory to be
running. altered.
Static memory allocation occurs when the ultimate size of a variable is chosen before
the program is performed. Compile-time memory allocation is another name for it.
• When we don't know how much memory will be required for the software ahead of time.
• When we need data structures that don't have a memory restriction.
• When you wish to make better use of your memory space.
• Dynamic memory allocation is required when using the concepts of structures and linked
lists in programming.