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]; }
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]; }