I'm getting this error message : declaration of 'arr' as multidimensional array must have bounds for all dimensions except the f
#include<bits/stdc++.h> using namespace std; #define ll int #define maxn 131070 #define for1() for(ll i=0;i<n;i++) #define for2() for(ll i=0;i<m;i++) #define for3() for(ll i=0;i<m;i++){ for(ll j=0;j<n;j++) #define pb push_back #define E cout<<endl; int isValid(int nextx,int nexty, int m, int n) { if(nextx>=0 && nextx<m && nexty>=0 && nexty<n) return 1; return 0; } class point { public: int row,col; void mpoint(int x,int y) { row=x; col=y; } }; class node { public: point p; int d; void mnode(point q, int dis) { p.row=q.row; p.col=q.col; d=dis; } }; int shortest(int arr[][], int m, int n, int x, int y) { if(arr[0][0]==0) return -1; bool vis[m][n]; memset(vis,false,sizeof(vis)); queue<node> q; point curr; curr.mpoint(0,0); node t; t.mnode(curr,0); q.push(t); int arrx[]={-1,0,1,0}; int arry[]={0,1,0,-1}; point c; node v; while(!q.empty()) { v=q.front(); c=v.p; if(x==c.row && y==c.col) return v.d; q.pop(); for(int i=0;i<4;i++) { int nextx=c.row+arrx[i]; int nexty=c.col+arry[i]; if(isValid(nextx,nexty,m,n)&& arr[nextx][nexty] && !vis[nextx][nexty]) { curr.mpoint(nextx,nexty); t.mnode(curr,(v.d)+1); q.push(t); vis[nextx][nexty]=true; } } } return -1; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); /////////////////////////// start /////////////////////////// int m,n,x,y; cin>>m>>n; int arr[m][n]; for(ll i=0;i<m;i++) { for(ll j=0;j<n;j++) cin>>arr[i][j]; } cin>>x>>y; if(shortest(arr,m,n,x,y)!=-1) cout<<shortest(arr,m,n,x,y); else cout<<"not found:/"; /////////////////////end//////////////////////////////////// return 0; }