realloc

(thing) by everyone Sun Jul 30 2000 at 20:07:06
The C function for reallocating memory previously allocated by malloc and friends. In other words, it changes the size of allocated memory.

#include <stdlib.h>

void *realloc( void *ptr, size_t size );


It returns a pointer to the new piece of memory, or NULL if it failed. If it returns NULL, ptr is unchanged, and of course, errno is set. If ptr is NULL, it returns malloc(size). If size is zero, the call is equivalent to free(ptr).
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.