1. ## 2d arrays quickie

(checking myself here) when you declare a 2d array, array[x][y], is an array created that has x-1 elements 'along' and y 'down' or are both 0 based hence an array[3][2] will be accesible in the range array[0 thru 2][0 thru 1].

thanks,

2. > or are both 0 based hence an array[3][2] will be accesible in the range array[0 thru 2][0 thru 1].
Yes, like this

3. crikey, you wasted no time thanks.

4. ## Suggestion...

A '2d' Array can come in many shapes sizes and forms. That is one of the most ineficient ones...

The 'best' way to do this is to use a pointer and a little math:

blah *myarray = new blah[sizex*sizey];

myarray[(y*sizex)+x] = wutever;

Hope that helps .

SPH

5. ## Another thing...

I also suggest instead of simple arrays using a linked list... but that is far more to talk about... if interested reply or email!

SPH

6. Another question, does array[x][y] create x arrays of y, or y arrays of x?

7. >That is one of the most ineficient ones...

Why? Dynamic allocation wasn't mentioned in the original or subsequent posts (until yours). Stack allocation will be quicker.

> Another question, does array[x][y] create x arrays of y, or y arrays of x?

x arrays of y.

8. > The 'best' way to do this is to use a pointer and a little math:
Which is exactly what the compiler uses when you write [x][y] anyway, so what's your point?

9. ## lol....

Once you've done a few projects... you will find the [][] sort of static pointer will not work as well as simply doing it yourself...

Don't make bad habbits, this very thing almost wreked one of my projects:

Try dynamic memory allocation here:

char **blah = (char**)new char[x];
*blah = new char[y];

blah[1][1] = (char)6;

you will usually need to set it up for a 'yx' call instead of 'xy', its jsut not a good habbit to 'form'.

SPH

10. >you will find the [][] sort of static pointer will not work as well as simply doing it yourself...

Why?