API reference / Files, memory, and strings
SDL_calloc
Function, SDL3
Allocates memory for an array, and fills it with zeros.
Declaration
#include <SDL3/SDL.h>
void * SDL_calloc(size_t nmemb, size_t size);Parameters
nmemb | The number of elements. |
size | The size of each element in bytes. |
Return value
A pointer to the memory, or NULL on failure.
Example
App *app = SDL_calloc(1, sizeof(App));See this code run in Hold state in a struct. Download the full program (.zip)
In SDL2
The name is the same.