Next Previous Contents

## 3.28 calloc

> Function

>   Allocate and clear memory.

> Header

>   `stdlib.h`

> Declaration

>   `void* __fastcall__ calloc (size_t n, size_t size);`

> Description

>   `calloc` allocates memory for an array of `n` elements of size `size`, clears the whole block with binary zeroes and returns a pointer to it. On error (not enough memory available), `calloc` returns `NULL`.

> Limits

>   - Clearing the memory may not have the expected effect on all platforms: pointers in the block may not be `NULL` and floating point variables may not be zero (0.0). In other words: The "clearing" effect of this function should be used with care for portable programs.
>   - The function is only available as fastcall function, so it may only be used in presence of a prototype.
> Availability

>   ISO 9899

> See also

>   _heapadd, _heapblocksize, _heapmaxavail, _heapmemavail, free, malloc, realloc

> Example

>   None.

Next Previous Contents