How do u go about initialising 2D and 3D arrays and giving them all values? They are integer values, btw.
i know " int array[] = { 1 }; " is for 1D arrays of integers, but i cant work out particularly how 3D arrays would be set...
How do u go about initialising 2D and 3D arrays and giving them all values? They are integer values, btw.
i know " int array[] = { 1 }; " is for 1D arrays of integers, but i cant work out particularly how 3D arrays would be set...
I don't think there is a way to initialize a 3D array with starting numbers. I think you have to do them value by value.
Sure you can. You can initialize any number of dimension of arrays that you can stand to do. (IE: whatever doens't make you go insane while you're typing it all out.Originally posted by frenchfry164
I don't think there is a way to initialize a 3D array with starting numbers. I think you have to do them value by value.
Here ya go:
Now you know why I kept it short (ie: 2x2x2).Code:int array[2][2][2] = { { {1,2}, {3,4}, }, { {5,6}, {7,8}, }, };
Quzah.
Hope is the first step on the road to disappointment.