What is wrong with the code

#include
using namespace std;
bool ratinmaze(char maze[1000][1000],int soln[][1000],int i,int j,int m,int n)
{
if(i==m && j==n)
{
soln[m][n]=1;
for(int i=0;i<=m;i++)
{
for(int j=0;j<=n;j++)
{
cout<<soln[i][j]<<" “;
}
cout<<endl;
}
cout<<endl;
return true;
}
if(i>m || j>n|| soln[i][j])
{
return false;
}
if(maze[i][j]==‘X’)
{
return false;
}
soln[i][j]=1;
bool right=ratinmaze(maze,soln,i,j+1,m,n);
bool down=ratinmaze(maze,soln,i+1,j,m,n);
soln[i][j]=0;
if(right||down)
{
return true;
}
return false;
}
int main() {
int n,m;
cin>>m>>n;
char maze[1000][1000];
int soln[1000][1000]={0};
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin>>maze[i][j];
}
}
bool ans=ratinmaze(maze,soln,0,0,m-1,n-1);
if(ans==false)
{
cout<<”-1";
}
return 0;
}

Hello @Kunalgoyal,

I have corrected your code:

Hope, this would help.
Give a like if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.