Rat in a maze problem,

I HAVE COMMENTED MY STEPS IN MY CODE
I AM GETTING CORRECT OUTPUT BUT GETTING ONE EXTRA OUTPUT FOR EACH OUTPUT
CANT UNDERSTAND WHY
PLEASE COMMENT ON MY MISTAKE IN MY CODE

my code
https://ide.codingblocks.com/s/41255

qn link;
https://hack.codingblocks.com/contests/c/512/398

Hey Jai, i have commented the corrections and updated your code.

THANKS
I HAVE MODIFIED MY CODE NOW
STILL ON SUBMISSION AM GETTING NO OUTPUT IN ONE TEST CASE​:confounded::cry:
new code
https://ide.codingblocks.com/s/41330

please tell me what that test case is so that i can correct my code🙄