A** ga = new A*[m]; for(int i = 0; i < m; i++) ga[i] = new A[n]; ... for(int i = 0; i < m; i++) delete []ga[i]; delete []ga; A这里是值类型,可以替换成int等。
C/C++ new 一个二维数组
最新推荐文章于 2024-06-27 11:18:59 发布
A** ga = new A*[m]; for(int i = 0; i < m; i++) ga[i] = new A[n]; ... for(int i = 0; i < m; i++) delete []ga[i]; delete []ga; A这里是值类型,可以替换成int等。