I'm not really sure what the correct way to initialize a 3d array is.
float array3D[100][100][100] = {0};
Is this correct? When I try to compile I get problems.
I think this is correct however, I am trying to create an array of size 1000x1000x1000. When I try to initialize an array of this size I get an error saying that an array must not exceed a certain size. Is there a way around this?
your code isn't wrong but the size of the array is too big. Your are creating a 100*100*100 sized array. if you try with a slower array it will work.
> Is there a way around this?
Yes, get a 64-bit processor with at least 8GB of memory, and an OS/Compiler that can actually take advantage of all that hardware.
Or you figure out how to factorise your problem into say 8 iterations with 500x500x500 blocks (assuming that will fit - it's still 0.5GB).
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.