free

Makes available for reallocation the area allocated by a previous calloc, malloc, or realloc call.

Format

#include  <stdlib.h>

void free  (void *ptr);

Argument

ptr
The address returned by a previous call to malloc, calloc, or realloc. If ptr is a NULL pointer, no action occurs.

Description

The ANSI C standard defines free as not returning a value; therefore, the function prototype for free is declared with a return type of void. However, since a free can fail, and since previous versions of the DEC C RTL have declared free to return an int, the implementation of free does return 0 on success and -1 on failure.


Previous Page | Next Page | Table of Contents | Index