How To Detect If Two SDL_Rects Are Intersecting?

I apologize for making so many posts in a short time, I’m just new to SDL but, I’m working on a hitbox system and I’m going about this by creating SDL_Rects then I’ll use a function or math formula to detect if they intersect. I’ve tried looking for a function to detect this but that failed, and I’ve also tried to come up with a formula for this but my brain is just not capable of that after trying to think of it for a while so I’m coming to the smart people of the SDL forum for help!

The function SDL_HasIntersection will tell you if two SDL_Rect intersect.

There’s also SDL_HasIntersectionF for SDL_FRect

I’ve tried that before but it said I needed to use a const SDL_Rect but I want there to be moving SDL_Rects so I can’t really use that.

In the case of a function parameter being a const pointer, it just means the function doesn’t make changes to whatever is being passed in.

It doesn’t mean you have to pass in a const SDL_Rect

Okay, sorry I didn’t know that XD