realloc() General Function realloc() Reallocate dynamic memory 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. ***** Example ***** For an example of this function, see the entry for calloc. ***** See Also ***** arena, calloc(), free(), general functions, malloc(), memok(), setbuf() ***** 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 will behave unpredictably if handed an incorrect ptr. COHERENT Lexicon Page 1