I can't draw a rectangled texture

Hi, I’m developing a sandbox game with SDLv2, and I’ve got to the point where I need to start rendering the first textures (Code below to understand). The function does return 0, but either the texture doesn’t render, the entire program quits normally, or I get a window that can’t listen to events. Here is some information:

TextureLoader(const char* path, SDL_Renderer** WRenderer, SDL_Window** WindowPointer) {    // I used to have a pointer to a bool that says whether the window should be closed or not, to free the textures

SDL_Surface* TextureWrapper = IMG_Load(path);
// Usual error checking
SDL_Texture TextureID = SDL_CreateTextureFromSurface(the usual parameters);
// Again checking for errors
SDL_Rect* Rectangles;
SDL_QueryTexture(TextureID, NULL, NULL, &Rectangles->w, &Rectangles->h);
Rectangles->x = 0;
Rectangles->y = 0;
// Here begins the error. If I don't pass an SDL_Rect struct here, it gives me a free dynamic resize. But if I do, the problems begin.
SDL_RenderCopy(*Renderer, TextureID, NULL, Rectangles);

How can I fix that? Maybe I need to change something? If I do, I get warnings, so I don’t even try it. If anybody knows how to make this work, let me know.

This is not a SDL_Rect, it is a pointer to a rect. Fix that. How your compiler didn’t shout at you is another matter, you should fix that too.

You are right about that, however I forgot to post the rest of the code. It points to another rect actually i just tried to save up space.

For starters, it’s super weird that your texture loader function is taking pointers to pointers for the renderer (and window, for some reason).

Second, on the line where you’re creating the texture, it needs to be a pointer. So instead of

SDL_Texture TextureID = SDL_CreateTexture(...);

make it

SDL_Texture *TextureID = SDL_CreateTexture(...);

You are also right, I was writing the texture with a pointer anyways tho because I’d get an error ohterwise. I fixed my problem however by recompiling SDL2 manually.