API reference / Files, memory, and strings
SDL_malloc
Function, SDL3
Allocates memory. The memory is not cleared.
Declaration
#include <SDL3/SDL.h>
void * SDL_malloc(size_t size);Parameters
size | The number of bytes. |
Return value
A pointer to the memory, or NULL on failure.
Example
cards = SDL_malloc((size_t)count_lines(file_text) * sizeof(Card));See this code run in Read a file. Download the full program (.zip)
Notes
- Free the memory with
SDL_free.
In SDL2
The name is the same.