#include <bits/stdc++.h>
using namespace std;
int cs(int n, int m, int ar[][101]){
int dp[n][m];
dp[0][0] = ar[0][0];
for(int i = 1; i<m; i++){
dp[0][i] = ar[0][i]+dp[0][i-1];
}
for(int i = 1; i<n; i++){
dp[i][0] = ar[i][0]+dp[i-1][0];
}
for(int i = 1; i<n; i++){
for(int j = 1; j<m; j++){
dp[i][j] = ar[i][j] + min(dp[i-1][j], dp[i][j-1]);
}
}
return dp[n-1][m-1];
}
int main(){
int n, m;
cin>>n>>m;
int arr[n][m];
for(int i = 0 ; i < n ;i++){
for(int j = 0; j<m; j++)
cin>>arr[i][j];
}
cout<<cs(n,m,arr)<<endl;
}
I am getting this error can someone help
main.cpp:30:18: error: cannot convert int ()[m] to int ()[101]
I can't add know the exact no. of rows and columns so I can't specify it beforehand, is there a way to get rid of this problem without using vector, the question link is: https://www.pepcoding.com/resources/online-java-foundation/dynamic-programming-and-greedy/min-cost-maze-traversal-official/ojquestion