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


calloc

Syntax

#include <malloc.h>

void *calloc(size_t num_elements, size_t size);

Description

This function allocates enough memory for num_elements objects of size size. The memory returned is initialized to all zeros. The pointer returned should later be passed to free (see section free) so that the memory can be returned to the heap.

You may use cfree (see section xfree) to free the pointer also; it just calls free.

Return Value

A pointer to the memory, or NULL if no more memory is available.

Example

Complex *x = calloc(12, sizeof(Complex));
cfree(x);


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

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 1997   by DJ Delorie     Updated Apr 1997  

Please take a moment to fill out this visitor survey
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)