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