Jan 11, 2009

Difference between Malloc vs Realloc

Difference between Malloc vs Realloc.
Malloc(n) allocate memory dynamically on the heap. Realloc(ptr, n) change the memory size of existing allocated memory. If n is greater than the old size and if sufficient space is not available subsequent to the old region, the function realloc( ) may create a new region and all the old data are moved to the new region.

No comments:

Post a Comment