#include <stdlib.h> void *realloc(void *ptr, size_t size);
This function changes the size of the region pointed to by ptr.
If it can, it will reuse the same memory space, but it may have to
allocate a new memory space to satisfy the request. In either case, it
will return the pointer that you should use to refer to the (possibly
new) memory area. The pointer passed may be NULL
, in which case
this function acts just like malloc
(see section malloc).
A pointer to the memory you should now refer to.
ANSI, POSIX
if (now+new > max) { max = now+new; p = realloc(p, max); }
Go to the first, previous, next, last section, table of contents.