Difference b/w static and Dynamic Memory allocation

Difference b/w static and dynamic memory allocation ?

Dynamic meemory allocation refers to the memory allocation at runtime but static allocation declaration is done at compile time. DMA memory comes from heap area and static alloation memory comes from stack area.DMA done using DMA function malloc,calloc.

Static allocation:

int arr[10];

Dynamic allocation

int *ptr;

ptr=(int *)malloc(sizeof(int)*10);

%d bloggers like this: