Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

calloc(3) Guardian Native C Library Calls Reference Manual
NAME
calloc - Allocates memory in an array
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcredll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycredll
SYNOPSIS
#include <sys/types.h>
#include <stdlib.h>
void *calloc(
size_t num_of_elts,
size_t elt_size);
PARAMETERS
num_of_elts Specifies the number of elements in the array.
elt_size Species the size of each element in the array.
DESCRIPTION
The calloc() function allocates space for an array with the number of elements specified by the
num_of_elts parameter, where each element is of the size specified by the elt_size parameter. The
space is initialized to zeros. If the elt_size parameter is 0 (zero), the function returns a null
pointer.
RETURN VALUES
This allocation function returns a pointer to space suitably aligned for storage of any type of
object. Cast the pointer to the type pointer-to-element before using it.
The calloc() function returns a null pointer if there is no available memory or if the memory area
has been corrupted by storing outside the bounds of a block. When this happens, the block
pointed to by the pointer parameter could be destroyed.
ERRORS
If any of the following conditions occurs, the calloc() function sets errno to the corresponding
value:
[ENOMEM] There is not enough storage memory in the system.
RELATED INFORMATION
Functions: free(3), getpagesize(3) malloc(3), realloc(3), valloc(3).
STANDARDS CONFORMANCE
The POSIX standards leave some features to the implementing vendor to define. In the HP imple-
mentation, the calloc() function returns a null pointer if the elt_size parameter is 0 (zero).
168 Hewlett-Packard Company 527192-018