CALLOC - allocate storage for array of elements.

(ANSI Standard)


#include <stdlib.h>
ptr = calloc( N, size );


size_t N;
is the number of elements in the array.
size_t size;
is the size of each element.
void *ptr;
points to the newly allocated array. The space begins at an alignment boundary that is suitable for storing objects of any data type. If an argument is improperly specified or the requested memory cannot be allocated, the NULL pointer is returned.


"calloc" returns a pointer to space for an array of N elements, each of the given size. This space is initialized to zero bits, which will give zero values for an integer or pointer type, but not for floating point types.

Normally the size argument should be specified using the "sizeof" operator.

See Also:

expl nsc lib malloc

expl nsc lib realloc

expl nsc lib free

Copyright © 1996, Thinkage Ltd.