Language: C++

#include <iostream>
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
int h,w;
bool ispossible(int i,int j,char **g){
    if(i<0 || j<0 || i>=h || j>=w || g[i][j]=='#'){
        return false;
    }
    return true;
}
void func(int i,int j,int **dp,int **vis,char **g){
    vis[i][j]=1;
    for(int k1=-1;k1<2;k1++){
        for(int k2=-1;k2<2;k2++){
            if(abs(k1)==abs(k2))
                continue;
        if(ispossible(i,j,g)){
            dp[i+k1][j+k2]=min(dp[i+k1][j+k2],dp[i][j]);
            if(v[i+k1][j+k2]==0)
                    func(i+k1,j+k2);
        }
        }
    }
    for(int k1=-2;k1<3;k1++){
        for(int k2=-2;k2<3;k2++){
            if(abs(k1)==abs(k2))
                continue;
        if(ispossible(i,j,g)){
            dp[i+k1][j+k2]=min(dp[i+k1][j+k2],dp[i][j]+1);
            if(v[i+k1][j+k2]==0)
                    func(i+k1,j+k2);
        }
        }
    }
}
int main()
{
    cin >> h >> w;
    int ch,cw;
    cin >> ch >> cw;
    int dh,dw;
    cin >> dh >> dw;
    char** g = new char*[h];
    for(int i=0;i<h;i++){
        g[i] = new char[w];
        for(int j=0;j<w;j++){
            cin >> g[i][j];
        }
    }
    bool** vis = new bool*[h];
    for(int i=0;i<h;i++){
        vis[i] = new bool[w];
        for(int j=0;j<w;j++){
            vis[i][j] = false;
        }
    }
    ll** dp = new ll*[h];
    for(int i=0;i<h;i++){
        dp[i] = new int[w];
        for(int j=0;j<w;j++){
            dp[i][j] = LONG_MAX;
        }
    }
    func(ch,cw,dp,vis,g);
    return 0;
}


Compiler output:
a.cc: In function 'void func(int, int, int**, int**, char**)':
a.cc:21:16: error: 'v' was not declared in this scope
   21 |             if(v[i+k1][j+k2]==0)
      |                ^
a.cc:22:25: error: too few arguments to function 'void func(int, int, int**, int**, char**)'
   22 |                     func(i+k1,j+k2);
      |                     ~~~~^~~~~~~~~~~
a.cc:13:6: note: declared here
   13 | void func(int i,int j,int **dp,int **vis,char **g){
      |      ^~~~
a.cc:32:16: error: 'v' was not declared in this scope
   32 |             if(v[i+k1][j+k2]==0)
      |                ^
a.cc:33:25: error: too few arguments to function 'void func(int, int, int**, int**, char**)'
   33 |                     func(i+k1,j+k2);
      |                     ~~~~^~~~~~~~~~~
a.cc:13:6: note: declared here
   13 | void func(int i,int j,int **dp,int **vis,char **g){
      |      ^~~~
a.cc: In function 'int main()':
a.cc:59:5: error: 'll' was not declared in this scope
   59 |     ll** dp = new ll*[h];
      |     ^~
a.cc:59:10: error: 'dp' was not declared in this scope; did you mean 'dw'?
   59 |     ll** dp = new ll*[h];
      |          ^~
      |          dw
a.cc:59:19: error: 'll' does not name a type
   59 |     ll** dp = new ll*[h];
      |                   ^~
a.cc:59:23: warning: capture of variable 'h' with non-automatic storage duration
   59 |     ll** dp = new ll*[h];
      |                       ^
a.cc:6:5: note: 'int h' declared here
    6 | int h,w;
      |     ^
a.cc: In lambda function:
a.cc:59:25: error: expected '{' before ';' token
   59 |     ll** dp = new ll*[h];
      |                         ^