Function SDL_calloc

pub unsafe extern "C" fn SDL_calloc(
    nmemb: usize,
    size: usize,
) -> *mut c_void
Available on crate feature dep_sdl3 only.
Expand description

Allocate a zero-initialized array.

The memory returned by this function must be freed with SDL_free().

If either of nmemb or size is 0, they will both be set to 1.

§Parameters

  • nmemb: the number of elements in the array.
  • size: the size of each element of the array.

§Return value

Returns a pointer to the allocated array, or NULL if allocation failed.

§Thread safety

It is safe to call this function from any thread.

§Availability

This function is available since SDL 3.2.0.

§See also