Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>realloc</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
realloc
=======

Syntax
------

     #include <stdlib.h>
     
     void *realloc(void *ptr, size_t size);

Description
-----------

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' (malloc:.).   

Return Value
------------

A pointer to the memory you should now refer to.

Example
-------

     if (now+new > max)
     {
       max = now+new;
       p = realloc(p, max);
     }


See Also: malloc

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson