Support Forums

Full Version: Multidimensional arrays..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just spent an hour going through some Java texts, and multidimensional arrays is when my head started to hurt.

Anyone know what these are actually used for? (the code examples are a little confusing to follow)
Multidimensional arrays can be used for things such as x and y coordinates in a game,
Code:
MyArray[x][y]
they are also handy for geometry,
Code:
MySquareArray[x][y]
or even cubes,
Code:
MyCubeArray[x][y][z]

Hopefully you catch my drift.
Hmm instead of declaring 7 different arrays in one script I made, I could have just made 4. Interesting....
(03-13-2010, 10:40 PM)MadHatter Wrote: [ -> ]Hmm instead of declaring 7 different arrays in one script I made, I could have just made 4. Interesting....

Although its a common way, more dimensions to an array actually is slower than using one.
For example,
Code:
MySquareArray[x][y]
is slower than,
Code:
MySquareArray[x*y]
(03-14-2010, 09:05 AM)Project Evolution Wrote: [ -> ]Although its a common way, more dimensions to an array actually is slower than using one.
For example,
Code:
MySquareArray[x][y]
is slower than,
Code:
MySquareArray[x*y]

I see. I'll keep that in mind.