ftp.delorie.com/djgpp/doc/libc/libc_81.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

calloc

Syntax

 
#include <stdlib.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 cfree) to free the pointer also; it just calls free.

Return Value

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

Portability

ANSI/ISO C C89; C99
POSIX 1003.2-1992; 1003.1-2001

Example

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


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004