Home / Questions / What is dynamic memory allocation?
Explanatory Question

What is dynamic memory allocation?

👁 749 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

  • In case of dynamic memory allocation, memory is allocated at runtime and memory can be increased while executing the program. It is used in the linked list.
  • The malloc() or calloc() function is required to allocate the memory at the runtime.
  • An allocation or deallocation of memory is done at the execution time of a program.
  • No dynamic pointers are required to access the memory.
  • The dynamic memory is implemented using data segments.
  • Less memory space is required to store the variable.

For example  
int *p= malloc(sizeof(int)*10);  

The above example allocates the memory at runtime.