Utility Functions and C Language Reference > C Language Reference > Alphabetical List of Functions > calloc


Example: calloc Memory Allocation Functions

Allocates an array and initializes all elements to zero.

void *calloc( size_t num elems, size_t elem_size); 

num elems The number of elements in the array.
elem_size The size of each element.

Return Values

Returns a void * type pointer to the allocated space. If the system could not allocate the requested block of memory or if any of the parameters was 0, returns a NULL pointer.

For calloc details, refer to your C language documentation.