I want to create a variable sized two dimensional array with number of rows as m and number of columns as n. th value of m and n is taken from the user during execution time. the following method works and produce output. Now let me know whether this is technically ok in all scenarios related to cpp.
#include<iostream>
using namespace std;
int main() {
int **arr, m,n;
cout<<"enter";
cin>>m>>n;
arr = new int*[m];
for(int i = 0; i < m; i++) {
arr[i]=new int[n]; // initializing a variable-sized array
}
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
cout<<arr[i][j]; // printing the array
}
}
}