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


malloc

Syntax

#include <stdlib.h>

void *malloc(size_t size);

Description

This function allocates a chunk of memory from the heap large enough to hold any object that is size bytes in length. This memory must be returned to the heap with free (see section free).

Return Value

A pointer to the allocated memory, or NULL if there isn't enough free memory to satisfy the request.

Example

char *c = (char *)malloc(100);


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

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