You need to store in the maze some kind of 'visited' flag, otherwise you just keep going over the same ground.

09-19-2006

theFOX

Here is the solution using a some kind of visited flag so that you donnot enter those cells that makes you unable to move again. If it is not clear, i will make an array of flags, each cell will hold a value ( 0 >> 4 ), if the value of cell (r, c) equ 4 that means, there is no possible way from this cell except the one that leads you to that cell. so that we donnot want to visite this cell ( with the value 4 ) again.

i considered the start position will be 0,1 and, the maze size will be 5 x 5

- In your case you considered the maze always has a solution, if it doesn't have a solution, the program will run into stack overflow !!-

btw, it is 2 AM here :sleepy: so donnot flame me if that doesn't work !!!!!!!