"Hendrix" <dr*******@yahoo.com> wrote in message
news:f0**************************@posting.google.c om...
Hi, I would like to pick four elements from a multidemensional array
and use the content of those elements. I want to do this without all
the subscript calls required for individual access, just want this for
speed. I know you can increment regular arrays via ++array or array++
etc. etc. but how do you do it with multidemensional arrays? lets say
I have array[x][y] and I need to access array[x+1][y+1] how can I do
this without the subscripts? The x and y count is at 64 by the way.
It's as simple as:
itemPtr += (rowLen+1);
Or in the case you mention:
itemPtr += 65;
Assuming that itemPtr points within: Item dataArray[64][64]; and
is in-range.
Note that, when starting to fiddle with item address calculations
in multi-dimensional arrays, I would recommend using a 1-dimensional
array and doing all offset calculations manually. While IIRC the
sub-arrays are supposed to be contiguous, using a consistent
approach should be preferred IMO.
hth,
--
Ivan Vecerina, Dr. med. <>
http://www.post1.com/~ivec
Soft Dev Manger, XiTact <>
http://www.xitact.com
Brainbench MVP for C++ <>
http://www.brainbench.com