Language: C++

#include<bits/stdc++.h>
#define ll unsigned long long int 
using namespace std;
    int row, col;
    
void findPath(int maze[][1000], int row, int col, int x,int y, int path[][col]){
    
    if(x<0 || x>=row || y<0 || y>=col)
        return;
    
    if(x==row-1 && y==col-1)
    {
        path[x][y]=1;  
            
        for(int i=0 ;i<row ;i++)
        {
            for(int j=0; j<col ;j++)
                cout<<path[i][j]<<" ";
        }
        cout<<endl;
        return;
    }
    
    if(maze[x][y]=='#' || path[x][y]==1)
        return;

   path[x][y]=1;
    
    findPath(maze,row, col,x+1,y,path);
    findPath(maze,row, col,x-1,y,path);
    findPath(maze,row, col, x,y+1,path);
    findPath(maze,row, col,x,y-1,path);
    
    path[x][y]=0;
}


void ratInAMaze(int maze[][col], int row, int col){

int path[row][1000] = {0};
   findPath(maze,row, col ,0,0,path);

}

int main()
{
    cin >> row >> col;
    int maze[row][1000];  
    for(int i=0; i<row; i++)
        for(int j=0; j<col; j++)
            cin >> maze[i][j];

    ratInAMaze(maze, row);
}



Compiler output:
a.cc:6:78: error: use of parameter outside function body before ']' token
    6 | void findPath(int maze[][1000], int row, int col, int x,int y, int path[][col]){
      |                                                                              ^
a.cc: In function 'void findPath(...)':
a.cc:8:8: error: 'x' was not declared in this scope
    8 |     if(x<0 || x>=row || y<0 || y>=col)
      |        ^
a.cc:8:25: error: 'y' was not declared in this scope; did you mean 'yn'?
    8 |     if(x<0 || x>=row || y<0 || y>=col)
      |                         ^
      |                         yn
a.cc:11:8: error: 'x' was not declared in this scope
   11 |     if(x==row-1 && y==col-1)
      |        ^
a.cc:11:20: error: 'y' was not declared in this scope; did you mean 'yn'?
   11 |     if(x==row-1 && y==col-1)
      |                    ^
      |                    yn
a.cc:13:9: error: 'path' was not declared in this scope; did you mean 'std::filesystem::__cxx11::path'?
   13 |         path[x][y]=1;
      |         ^~~~
      |         std::filesystem::__cxx11::path
In file included from /usr/include/c++/14/filesystem:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_path.h:293:9: note: 'std::filesystem::__cxx11::path' declared here
  293 |   class path
      |         ^~~~
a.cc:24:8: error: 'maze' was not declared in this scope
   24 |     if(maze[x][y]=='#' || path[x][y]==1)
      |        ^~~~
a.cc:24:13: error: 'x' was not declared in this scope
   24 |     if(maze[x][y]=='#' || path[x][y]==1)
      |             ^
a.cc:24:16: error: 'y' was not declared in this scope; did you mean 'yn'?
   24 |     if(maze[x][y]=='#' || path[x][y]==1)
      |                ^
      |                yn
a.cc:24:27: error: 'path' was not declared in this scope; did you mean 'std::filesystem::__cxx11::path'?
   24 |     if(maze[x][y]=='#' || path[x][y]==1)
      |                           ^~~~
      |                           std::filesystem::__cxx11::path
/usr/include/c++/14/bits/fs_path.h:293:9: note: 'std::filesystem::__cxx11::path' declared here
  293 |   class path
      |         ^~~~
a.cc:27:4: error: 'path' was not declared in this scope; did you mean 'std::filesystem::__cxx11::path'?
   27 |    path[x][y]=1;
      |    ^~~~
      |    std::filesystem::__cxx11::path
/usr/include/c++/14/bits/fs_path.h:293:9: note: 'std::filesystem::__cxx11::path' declared here
  293 |   class path
      |         ^~~~
a.cc:27:9: error: 'x' was not declared in this scope
   27 |    path[x][y]=1;
      |         ^
a.cc:27:12: error: 'y' was not declared in this scope; did you mean 'yn'?
   27 |    path[x][y]=1;
      |            ^
      |            yn
a.cc:29:14: error: 'maze' was not declared in this scope
   29 |     findPath(maze,row, col,x+1,y,path);
      |              ^~~~
a.cc: At global scope:
a.cc:38:28: error: size of array 'maze' is not an integral constant-expression
   38 | void ratInAMaze(int maze[][col], int row, int col){
      |                            ^~~
a.cc: In function 'int main()':
a.cc:53:16: error: cannot convert 'int (*)[1000]' to 'int (*)[1]'
   53 |     ratInAMaze(maze, row);
      |                ^~~~
      |                |
      |                int (*)[1000]
a.cc:38:21: note:   initializing argument 1 of 'void ratInAMaze(int (*)[1], int, int)'
   38 | void ratInAMaze(int maze[][col], int row, int col){
      |                 ~~~~^~~~~~~~~~~