HP C/iX Library Reference Manual (30026-90004)

Chapter 5 291
HP C/iX Library Function Descriptions
realloc
realloc
Changes the size of a block of allocated memory.
Syntax
#include <stdlib.h>
void *realloc (void *
ptr
, size_t
size
);
Parameters
ptr
A pointer to a block of memory previously allocated.
size
The new size, in bytes.
Return Values
x A successful call to realloc() returns a pointer to the possibly moved
block of allocated memory.
NULL There is not enough available memory. The block pointed to by
ptr
is left
intact, or,
size
is 0.
Description
The realloc function changes the size of the block pointed to by
ptr
to
size
bytes and
returns a pointer to the block. The location of the block may be changed by this function.
The contents are unchanged up to the lesser of the new and old sizes.
See Also
malloc(), free(), calloc() ANSI C 4.10.3.4, POSIX.1 8.1