The reason you can go outside the screen to the left and up is because you are limiting the cooridnates to negative values instead of 0 on lines 316-324. This should avoid that problem.
1 2 3 4 5 6 7 8 9
if(dstX1<0)
{
dstX1=0;
}
if(dstY1<0)
{
dstY1=0;
}
You can't go all the way to the right or down because ScreenWidth and ScreenHeight is smaller than the size of the window.
it works good.The problem is that when the player go up to obstacles nothing happens and he continue to walk.
I just noticed, all your obstacles have an Y of at least 910. Given that you can't go past ScreenHeight because of line 335, you player never collides simply because there are no obstacles in the area in which it can move
I seriously advice to write a CheckCollision that takes two SDL_Rect. It makes the code a lot more readable