int ***arr = new int**[X]; for (i = 0; i < z_size; ++i) { arr[i] = new int*[Y]; for (j = 0; j < WIDTH; ++j) arr[i][j] = new int[Z]; }