Rat in a maze where rat can travel in 4 directions left right up down

https://ide.codingblocks.com/s/56942
what is wring in this code its telling runtime error…

you are going into infinite recursion as if rat went left and then again come back to right and this repeated infinitely