Saturday, October 18, 2008

Free vs. Realloc

free(): release the memory allocated to the object by malloc(),realloc() or calloc(), making it avaible for future allocation.
realloc(void* ptr,size_t size): expand or reduce the size of the allocated block of memory to size. when size=0, it is equal to free. when ptr is NULL, it works the same as malloc. when the size is larger than the old block, then newly allocated portion are unknown.

No comments: