COHERENT manpages
This page displays the COHERENT manpage for realloc() [Reallocate dynamic memory].
List of available manpages
Index
realloc() -- General Function (libc) Reallocate dynamic memory #include <stdlib.h> char *realloc(ptr, size) char *ptr; unsigned size; realloc() helps you manage a program's arena. It returns a block of size bytes that holds the contents of the old block, up to the smaller of the old and new sizes. realloc() tries to return the same block, truncated or extended; if size is smaller than the size of the old block, realloc() will return the same ptr. If ptr is set to NULL, realloc() behaves like malloc(). Example For an example of this function, see the entry for calloc(). See Also alloca(), arena, calloc(), free(), libc, malloc(), memok(), setbuf(), stdlib.h ANSI Standard, §7.10.3.4 POSIX Standard, §8.1 Diagnostics realloc() returns NULL if insufficient memory is available. It prints a message and calls abort() if it discovers that the arena has been corrupted, which most often occurs by storing past the bounds of an allocated block. realloc() behaves unpredictably if handed an incorrect ptr.