Rate chases the cheese

https://ide.codingblocks.com/s/316025…
Can you find whats wrng in my code its showing runtime error

your code is not correct you are considering only two chase but there are total 4 moves
left right up down

you can see this reference Code to understand
Reference Code

reason of run time error may be
in the code at line no 30
if((a[i][j+1])=='O')
and line no 36
you are accessing i+1 and j+1 without check whether they exist or not that is the reason you are gettting run error