SDL_CreateWindow vs SDL_Surface

I’m new to SDL and I am following lazyfoo and a couple other tutorials. I am seeing both SDL_CreateWindow and SDL_Surface used. I do not understand the difference of these 2 API calls and when to use one vs the other or both together.

I’m thinking maybe you create a window and then lay SDL_Surface over the window like a layer?

If anyone could explain the difference and when to use each would be appreciated and in laymen terms, please.

Thanks,
rlp

SDL_Surface is like an image file that has been loaded into memory; it’s pixel data and information about the format of that data.

SDL_Window represents the thing that visually contains your program (the window…).

If you look in the SDL wiki API reference at the functions that use SDL_Window, they’re all ones which affect things like the window size, the title caption, and so on. If you look at the functions that use SDL_Surface, they include things that affect how the image data will be used when rendered or uploaded to an SDL_Texture.