calloc Function* (tigcc.a)

alloc.h, stdlib.h

void *calloc (unsigned short NoOfItems, unsigned short SizeOfItems);

Allocates a memory block for a given number and size of items.

calloc allocates a block of NoOfItems x SizeOfItems bytes from the memory heap. On success, calloc returns a pointer to the newly allocated block of memory. If not enough space exists for the new block, it returns NULL. The allocated block will be cleared to zero content.

Note: In releases of TIGCCLIB prior to 2.0, calloc was implemented here as a macro, Now, it is a function. It first calls malloc with NoOfItems x SizeOfItems as the argument, then calls memset if the first call was successful.


Uses: HeapAllocPtr, memset
Used by: calloc_throw


See also: malloc, realloc, free, calloc_throw