calloc

OS/161 Reference Manual

Name

calloc - allocate and clear memory

Library

Standard C Library (libc, -lc)

Synopsis

#include <stdlib.h>

void *
calloc(size_t number, size_t size);

Description

calloc allocates number*size bytes of memory, zeros it, and returns a pointer to it. It is equivalent to calling malloc(number*size) followed by bzero.

If the product number*size overflows the range of size_t, calloc fails.

Return Values

calloc returns a pointer to the memory allocated. If memory cannot be obtained, NULL is returned.

See Also

malloc, realloc, free