Welcome, Guest. Please login or register.

Author Topic: Finding the address of an array element  (Read 8787 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12114
    • Show all replies
    • http://www.troubled-mind.com
Re: Finding the address of an array element
« on: March 14, 2003, 01:02:00 PM »
Ok, this is how I would visulise it:

for a two dimential array
to find x,y  is easy:

Data = y(Addr+x)

This treats your array like a page:

***********
***********
***********
***********

where each * represents your data

Thus for a three dimentinal array, I would think of it like a book with lots of pages:

Data=z(y(Addr+x)


Thus:

***********   ***********   ***********
***********   ***********   ***********
***********   ***********   ***********
***********   ***********   ***********

I can't visulise more than 3 dimentions (lots of books? in lots libraries in lots of cities... gah.. the list goes on...), damn my human brain, so for an array where you have n dimentions, you would need a loop to keep multiplying by n-1 until you got to n!!! wow that would use a lot of memory!!!!

I suggest you find a size you are happy with an sick to it :-D

Unless you are doing some kind of qunatum mechanics, I don't see the need for more than 4 dimentions to an array :-p