Table of Contents        Previous topic       Next topic       

C LIBRARY FUNCTIONS->Detailed Descriptions->calloc()


#include <malloc.h>

void *calloc(size_t num, size_t size);Allocate an array in memory with elements initialised to zero

num    Number of elements
size    Length in bytes of each element


This function allocates a memory block of num * size bytes.  The first byte of the block is guaranteed to be suitably aligned for the storage of any object.  The memory is initialised to 0.

Return Value

The function returns a pointer pointing to the first byte in the block.

A NULL value is returned if insufficient memory is available.