The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C Dynamic Memory Allocation

Why Dynamic Memory Allocation

Let us consider that you are starting your own company where you provide a different operating systems for your clients. You have 6 individual teams in your startup company where every team has their own individual part to program in a microprocessor. Unfortunately microprocessors are inbuilt with very small amount of memory. Now its your responsibility to allocate or divide certain amount of memory in the microprocessor to every individual teams. Here is the dynamic memory allocation in c programming to help you out there.

dynamic memory allocation in c

Facts About Dynamic Memory Allocation

  • DMA is the programmer's shorthand to represent Dynamic Memory Allocation.
  • Allocation of memory to a program is done at the time of execution.
  • A Pointer is the only way to access Dynamic Memory Allocation.

When To Use Dynamic Memory Allocation

When a programmer knows the exact size of the data, array is good choice. When a programmer have no idea about the size of the data, then you are left with one way is by using Dynamic Memory Allocation.

Inbuilt Functions For Dynamic Memory Allocation

In-Built Functions Purpose
malloc() Allocates memory where allocated memories are represented by some garbage value.
calloc(). Allocates memory where allocated memories are represented by zero.
free() To free the already allocated memory.
realloc() To reallocate the memory dynamically as per demand.
coreleft() To measure the unused memory.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report