Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multidimensional arrays..
#1
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)
Reply
#2
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.
My SMF Modifications:
http://anthony.vibrantvps.com/smf
Reply
#3
Hmm instead of declaring 7 different arrays in one script I made, I could have just made 4. Interesting....
[Image: hstj7q.png]
Reply
#4
(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]
My SMF Modifications:
http://anthony.vibrantvps.com/smf
Reply
#5
(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.
[Image: hstj7q.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)