Advantages of Dynamic Memory Allocation

      The main advantage of using dynamic memory allocation is preventing the wastage of memory. This is because when we use static memory allocation, a lot of memory is wasted because all the memory allocated cannot be utilised. Thus dynamic memory allocation helps us to allocate memory as and when required and thus saves memory.

  • In static memory allocation, if we allocate 1000 memory locations as int name[1000]; While running the program only half of this may be used. The rest is unused and idle. It is a wastage of memory.

  • If we want to change the size of the array in the program, it is possible by reediting the program. It is a time consuming process. 

In dynamic memory allocation the above two problems won't occur because, the memory space for variables is allocated only during execution.

External Links:

anibul1.gifwww.scribd.com/doc/32965073/Dynamic-Memory-Allocation

anibul1.gifwww.chemie.fu-berlin.de/chemnet/use/info/libc/libc_3.html

anibul1.gifwebdocs.cs.ualberta.ca/~holte/T26/dyn-mem-alloc.html

anibul1.gifwww.exforsys.com/tutorials/c-language/dynamic-memory-allocation-in-c.html

 

From the Web

Suggestions: (1)
Loading...

See few results | more results

Search: [Press Enter]

Share |