Difference between dynamic and static memory allocation in C?


MEMORY ALLOCATION MODELS……

STATIC MEMORY ALLOCATION

DYNAMIC MEMORY ALLOCATION


Memory is allocated before the execution of the program begins.
(During Compilation)

Memory is allocated during the execution of the program.

No memory allocation or deallocation actions are performed during Execution.

Memory Bindings are established and destroyed during the Execution.

Variables remain permanently allocated.

Allocated only when program unit is active.

Implemented using stacks and heaps.

Implemented using data segments.

Pointer is needed to accessing variables.

No need of Dynamically allocated pointers.

Faster execution than Dynamic.

Slower execution than static.

More memory Space required.

Less Memory space required.