www.delorie.com/djgpp/doc/libc-2.01/libc_527.html   search  
Go to the first, previous, next, last section, table of contents.


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 (see section 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);
}


Go to the first, previous, next, last section, table of contents.

  prev next   webmaster     delorie software   privacy  
  Copyright © 1997     Updated Apr 1997