c++ 中创建动态二维数组的程序代码
动态创建一维数组
int *arr; //it can be any other type (char, float)
arr = new int[n]; //n should be integer variable
动态创建二维数组
int **arr;
int N,M;
cin >> N >> M;
arr = new int*[N];
for(int i=0;i<N;i++) { arr[i] = new int[M]; }
动态创建一维数组
int *arr; //it can be any other type (char, float)
arr = new int[n]; //n should be integer variable
动态创建二维数组
int **arr;
int N,M;
cin >> N >> M;
arr = new int*[N];
for(int i=0;i<N;i++) { arr[i] = new int[M]; }