realloc

Reallocates memory

#include <stdlib.h>
void *realloc (
        void *block,
        size_t s
)

Arguments

block Pointer to area to be reallocated
s Size of new area

Return Value

A pointer to the reallocated block is returned. The reallocated block may be located at a different address than the original block. NULL is returned if the allocation failed in which case the original block is not released.

Explanation

The previously allocated area of storage pointed to by block is reallocated to the size specified by s. realloc() is identical to malloc() if block is NULL.

See Also

calloc(), malloc(), free()