hi trying to load a 3d array from a file array widthlength3
hi
trying to load a 3d array from a file ....... array [width][length][3] - as it loads - it crashes
someone said I need a pointer- please show how c++
Solution
#include <vector>
using std::vector;
#define HEIGHT 5
#define WIDTH 3
#define DEPTH 7
int main() {
vector<vector<vector<double> > > array3D;
// Set up sizes. (HEIGHT x WIDTH)
array3D.resize(HEIGHT);
for (int i = 0; i < HEIGHT; ++i) {
array3D[i].resize(WIDTH);
for (int j = 0; j < WIDTH; ++j)
array3D[i][j].resize(DEPTH);
}
// Put some values in
array3D[1][2][5] = 6.0;
array3D[3][1][4] = 5.5;
return 0;
}
![hi trying to load a 3d array from a file ....... array [width][length][3] - as it loads - it crashes someone said I need a pointer- please show how c++Solution# hi trying to load a 3d array from a file ....... array [width][length][3] - as it loads - it crashes someone said I need a pointer- please show how c++Solution#](/WebImages/27/hi-trying-to-load-a-3d-array-from-a-file-array-widthlength3-1070980-1761560984-0.webp)