Copyright © tutorialspoint.com
Synopsis:
Description:The size of the memory block pointed to by the mem_address parameter is changed to the newsize bytes, expanding or reducing the amount of memory available in the block. In case that mem_address is NULL, the function behaves exactly as malloc, assigning a new block of newsize bytes and returning a pointer to the beginning of it. In case that the newsize is 0, the memory previously allocated in mem_address is deallocated as if a call to free was made, and a NULL pointer is returned. Return ValueA pointer to the reallocated memory block, which may be either the same as the mem_address argument or a new location. Example
It will proiduce following result:
|
Copyright © tutorialspoint.com