3次元配列

3darray.png

newする時

int*** array3d = new array3d**[nx];
    for (int x = 0; x < nx; x++) {
        array3d[x] = new array3d*[ny];
        for (int y = 0; y < ny; y++) {
            array3d[x][y] = new array3d[nz];
        }
    }

deleteする時

for (int x = 0; x < nx; x++) {
        for (int y = 0; y < ny; y++) {
            delete[] array3d[x][y];
        }
        delete[] array3d[x];
    }
    delete[] array3d;

multiarraynew

サポートサイト Wikidot.com multiarraynew