SDL School

API reference / Images and textures

SDL_DestroySurface

Function, SDL3

Frees a surface.

Declaration

#include <SDL3/SDL.h>

void SDL_DestroySurface(SDL_Surface *surface);

Parameters

surfaceThe surface. NULL is safe.

Example

Load an image
SDL_DestroySurface(surface);

See this code run in Load an image. Download the full program (.zip)

In SDL2

Use SDL_FreeSurface.

See also