HP C/iX Library Reference Manual (30026-90004)

118 Chapter5
HP C/iX Library Function Descriptions
calloc
calloc
Allocates a block of memory.
Syntax
#include <stdlib.h>
void *calloc (size_t
nelem
, size_t
elsize
);
Parameters
nelem
The number of elements, each of size
elsize
, to be found in the block of
allocated memory.
elsize
The size, in bytes, of each element speciļ¬ed in
nelem
.
Return Values
x A pointer to the allocated space.
NULL There is not enough available memory or
elsize
is zero.
Description
The calloc function allocates space for an array of
nelem
elements of size
elsize
. The
space is initialized to all bits zero. It is suitably aligned for any use.
See Also
malloc(), free(), realloc(), ANSI C 4.10.3.1, POSIX.1 8.1