SDL School

API reference / Files, memory, and strings

SDL_memmove

Function, SDL3

Copies a block of memory, and it handles a source and a destination that overlap.

Declaration

#include <SDL3/SDL.h>

void * SDL_memmove(void *dst, const void *src, size_t len);

Parameters

dstThe destination.
srcThe source.
lenThe number of bytes.

Return value

The destination pointer.

Example

Snake
SDL_memmove(&snake[1], &snake[0], (size_t)(snake_length - 1) * sizeof(Cell));

See this code run in Snake. Download the full program (.zip)

In SDL2

The name is the same.