realloc [C++ Reference]
Keywords: c,mem,realloc
Date: 2009-05-13T00:02:27-0700

[[realloc]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- fr
- it
- jp
- pl
- ru
- tr

## realloc

Syntax:

        #include <cstdlib>
        void *realloc( void *ptr, size_t size );

The realloc() function changes the size of the object pointed to by ptr to the given size. size can be any size, larger or smaller than the original. The return value is a pointer to the new space, or NULL if there is an error. On failure the original memory block is not freed or moved. If ptr is NULL, realloc() acts just like malloc, creating a new memory space and returning the pointer to that new location.

Related Topics: calloc, free, malloc

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •