realloc

Reallocates heap memory.

void * realloc (void * old_block, size_t size);

Required Header
<stdlib.h>

Return Value

This function returns the pointer to the reallocated heap block. NULL indicates an error.

Parameters

old_block

  A pointer to the old heap block

size

  The number of bytes to reallocate to

Remarks

The realloc function attempts to allocate size bytes from the heap and return a pointer to the allocated block. Data in the old heap block is copied into the new heap block, before that block is freed.

Standard Library

See Also    _alloca, calloc, free, malloc