Difference between Static and Dynamic memory allocation - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Sunday 5 November 2017

Difference between Static and Dynamic memory allocation

In Dynamic Memory Allocation, memory is allocated at run time. Whereas in Static Memory Allocation, memory is allocated at compile time.
Example :

//Static allocation:
int a[20];

//Dynamic allocation
int *ptr;
ptr=(int *)malloc(sizeof(int)*20);

No comments:

Post a Comment

Post Top Ad