Difference between revisions of "cpp/memory/c/realloc"
From cppreference.com
m (Text replace - "{{cpp|" to "{{c|") |
m (r2.7.3) (Robot: Adding de, fr, ja, pt, zh) |
||
Line 18: | Line 18: | ||
pointer to the beginning of newly allocated memory or {{c|NULL}} if error has occurred. The pointer must be deallocated with {{rlpf|free}}. | pointer to the beginning of newly allocated memory or {{c|NULL}} if error has occurred. The pointer must be deallocated with {{rlpf|free}}. | ||
+ | |||
+ | [[de:cpp/memory/c/realloc]] | ||
+ | [[fr:cpp/memory/c/realloc]] | ||
+ | [[ja:cpp/memory/c/realloc]] | ||
+ | [[pt:cpp/memory/c/realloc]] | ||
+ | [[zh:cpp/memory/c/realloc]] |
Revision as of 15:18, 4 May 2012
Defined in header <cstdlib>
|
||
void *realloc( void *ptr, size_t new_size ); |
||
Reallocates the given area of memory. It must be previously allocated by malloc()
, calloc()
or realloc()
, otherwise the results are undefined.
The contents of the area remain unchanged up to the lesser of the new and old sizes. If the area is expanded, the contents of the new part of the array are undefined.
Parameters
ptr | - | pointer to the memory area to be reallocated |
new_size | - | new size of the array |
Return value
pointer to the beginning of newly allocated memory or NULL if error has occurred. The pointer must be deallocated with free()
.