3D arrays

closed account (3qD3AqkS)
Hi. When i was "browsing" the beginners forum, i saw a lot of array problems. And when i wanted to help, i realised that i didn't even knew a lot of arrays at all.

So When i learned it, i think it is "A variable that stores multiple data". now maybe i get that part. but the part i don't get is a 3D array.

What is the use? When is it best to use? I just don't get it.

thx.

gentlegal
Think of an array like single drawer filing cabinet.

Where you get to choose what type of data the cabinet can hold.
Also the filing cabinet can only hold one type of data type at a time. Like integers or doubles
or floats and so forth.
Where each slot of the filing cabinet is labeled with a number starting at zero and the second is labeled with 1, and the third is labeled with 2 and so forth.

Think of a 2d array as more than one of these filing cabinets stacked on top of each other.
Where each filing cabinet is a row.
Suppose you have 3 stacked on top of each other.
Then the top filing cabinet would be row 0, the second would be row 1 and the bottom would be row 2.

Think of 3d array as two or more 2d arrays stacked next to each other as columns. Like a building.
Suppose you have 3 columns of 2d arrays stacked next to each other.

Then the first column is column number 0 and the second column is column number 1 and the third column is column number 2.

Look at this picture for a visualization.
http://eli.thegreenplace.net/images/2015/row-major-3D.png




Topic archived. No new replies allowed.