Header Ads Widget

Difference between static and dynamic memory allocation

In the static memory allocation memory is allocated in the sequential  manner  but in the dynamic memory allocation memory is allocated in random manner. the difference between static and dynamic memory allocation is as follow.

Static Memory Allocation

Dynamic memory allocation

     1)  All the data element stored in the       sequential manner.

      2)  We fix the size of memory before compilation.

      3)  Wastage of memory.

      4)  We need to store only address of first block of memory.

      5)  Static is more efficient than dynamic.

      1)  All the data element stored in random manner.

      2)  We fix the size of memory at the run time .

      3)  Nominal wastage of memory .

      4)  We need to store address of every element.

      5)  Dynamic is less efficient than static.

 






 Recommended Post:

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-