Not getting required output

#include
using namespace std;
bool ratinmaze(char in[][1000], int out[][1000], int i, int j, int n, int m)
{
//base case
if(i==n and j==m)
{
out[i][j]=1;
//print the output
for(int i = 0 ; i<=n ; i++)
{
for(int j = 0 ; j<=m ; j++)
{
cout<<out[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
return true;
}
// rec case
if(i>n or j>m)
return false;

if(in[i][j]=='X')
return false;
// Assuming current soln is correct
out[i][j] = 1;
bool right_path  = ratinmaze(in,out,i,j+1,n,m);
bool down_path = ratinmaze(in,out,i+1,j,n,m);
//backtracking
out[i][j] = 0;
if(right_path)
return true;
//else if(down_path)
return true;

return false;
}
int main() {
char in[1000][1000] ;
int out[1000][1000] = {0};
int n,m;
cin>>n>>m;
//cin.get();
for(int i = 0; i<n ; i++)
{
for(int j = 0; j<m ; j++)
{
cin>>in[i][j];

	}
}
bool ans = ratinmaze(in,out,0,0,n-1,m-1);
    if(ans == false)
	{
		cout<<-1;
	}
return 0;

}

hello @chitwan_manchanda
pls share ur code using cb ide

@chitwan_manchanda
pls check ur updated code here(comment added)->

https://ide.codingblocks.com/s/352617

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.