Rat in a maze problem

Can someone please debug my code for Rat in a maze problem. Its giving segmentation fault. Thankyou.
Link to My Code