Hi,
i can suggest u 3 ways
1_ When both dimensions are available globally (either as a macro or as a global constant).
const int M = 3;
const int N = 3;
void print(int arr[M][N])
{ } used when the problem statement gives u fixed size 2d array which happens to be very rare
2.When only second dimension is available globally (either as a macro or as a global constant)
make it some big value ( generally the maximum defined in the constraint )
const int N = 3;
void print(int arr[][N], int m)
{ } // following the logic that only the no of column is a must to be passed in case of 2 d array
- use vector<vector> vec approach ( i really feel this to be convinient)