SDL School

API reference / Math

SDL_min

Macro, SDL3

Gives the smaller of two values. This is a macro.

Declaration

#include <SDL3/SDL.h>

#define SDL_min(x, y)

Parameters

xThe first value.
yThe second value.

Return value

The smaller value.

Example

Pong
ball_speed = SDL_min(ball_speed + BALL_SPEED_UP, BALL_MAX_SPEED);

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

In SDL2

The name is the same.

See also