calloc

Syntax

void* calloc(int number, int size)

Arguments

number
The number of elements to be reserved.
size
The size of each of the elements to be reserved, measured in bytes.

Return

A pointer to the allocated memory.

Description

Reserves memory for an array of number elements, each size bytes in size. Each byte of memory allocated using this function is initialized to 0. If you do not require this, malloc may be preferred for speed.
If the memory could be allocated, a pointer to the first element in the reserved memory block is returned.
If the memory could not be allocated (e.g., due to memory shortage or a high degree of memory fragmentation), a NULL value is returned instead.
Any memory reserved by use of this function must be manually deallocated by means of the free function; failure to do so will result in memory leakage and may ultimately crash the system.

Example

%ffp

OnFilterStart:
{
    // Allocate a string for 255 characters.
    char* buffer_1 = calloc(255, 1);

    free(buffer_1);
}

Also see

free, malloc, realloc