Rat and maze problem hacker blocks

what is problem with my code and also tell how to print only one sol as Prateek bhaiya video gives all sol
#include
using namespace std;
bool issafe(char arr[][1001],int row,int col,int n,int m){
if(row<n && col<m && arr[row][col]!=‘X’){
return true;
}
return false;
}

bool maze(char arr[][1001],int row,int col,int sol[][1001],int n,int m){
if(row==n && col==m) {
sol[row][col] = 1;
return true;
}

  if(issafe(arr,row,col,n,m)){
       sol[row][col] = 1;

       
       if(maze(arr,row,col+1,sol,n, m)){
           return true;
       }
       if(maze(arr,row+1,col,sol,n,m)){
           return true;
       }

       sol[row][col] = 0;
       return false;

  }

  return false;

}

int main() {
int n,m;
cin>>n>>m;
char arr[1001][1001];
for(int i = 0;i < n;i++){
for(int j = 0;j < m;j++){
cin>>arr[i][j];
}
}
int row = 0;int col = 0;
int sol[1001][1001] = {0};
if( maze(arr,row,col,sol,n-1,m-1)) {
cout<<“path exist”<<endl;
for (int i = 0; i <= n; ++i)
{
for (int j = 0; j <= m; ++j)
{
cout<<sol[i][j]<<" ";
}
cout<<endl;
}
} else{
cout<<“path doesn’t exist”<<endl;
}

}

@kshitiz.gzb Please save the code in codingblocks ide and then share its link. It is easy for us to debug then.
You can restrict this code to print only one solution by using an if-else condition something like this:
bool rightsuccess=ratinmaze(maze,output,i,j+1,m,n);
if(!rightsuccess) //If by moving right you cannot reach the end then only move downwards.
ratinmaze(maze,output,i+1,j,m,n)

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.