Rat in a maze question ,can you check my code and tell where i went wrong

#include <bits/stdc++.h>
using namespace std;
bool canmoveright(char in[5][4],int cr,int cc,int m,int n)
{
if(in[cr][cc+1]==β€˜0’ && cr<m && cc+1< n)
{
return true;
}
return false;
}
bool canmovedown(char in[5][4],int cr,int cc,int m,int n)
{
if(in[cr+1][cc]==β€˜0’ && cr+1<m && cc<n)
{
return true;
}
return false;
}
bool rmaze(char in[5][4],char out[5][4],int cr,int cc,int m,int n)
{
//base case
if(cr==m-1 && cc==n-1)

{
    return true;
}

//recursive case
if(canmoveright(in,cr,cc,m,n))
{    out[cr][cc]='1';
     return rmaze(in,out,cr,cc+1,m,n);

}
if(canmovedown(in,cr,cc,m,n))
{
     out[cr][cc]='1';
     return rmaze(in,out,cr+1,cc,m,n);

}
if(!canmoveright && !canmovedown )
{
    return false;
}
  out[cr][cc]='0';

}
int main()
{
int m,n;
char arr[5][4];
char out[5][4]={β€˜0’};
for(int i=0;i<5;i++)
{
for(int j=0;j<4;j++)
{
cin>>arr[i][j];
}
}
if(rmaze(arr,out,0,0,5,4))
{
for(int k=0;k<5;k++)
{
for( int l =0;l<4;l++)
{
cout<<out[k][l];
}cout<<endl;

}}
return 0;}

please always provide the ide link of your code, it is easy to read and debug there

you have to do some corrections in your recursive rmaze() function:-
(i) when you are checking the camoveright() , then inside this you can just directly return rmaze(in,out,cr,cc+1,m,n), because there are chances when the it will return false but the path may be like first moving down then something else.
(ii) same correction for canmovedown() function.

(iii) Whar does this statement means, nothing(these are func not variables), remove it.
if(!canmoveright && !canmovedown )
{
return false;
}

I have done these modifications in your code, so if you want then you can refer to this https://ide.codingblocks.com/s/207823 but i will suggest you to first try all these on your own first.

Thanks for solving my doubt

@pranay2100rox Mark this doubt as resolved if you don’t have any furthur doubt in this.