I do not mean a 5-dimensional array.
(
&array[1] + 1) is EXACTLY equivalent to (
&array[2])
I'm fine with this if its bytes (Since +1 byte <=> the next byte), but when working with structures (Or any variable greater than 1 byte in size), I disagree with the standards.
Quote:Original post by iMalcIf it's behaviour seems wrong, then you are probably doing something in a bad way. Show some real code so we can show you the way that you should really be doing it.
Ok.
You have a very large block of
linear memory...
[][][][][][][][][][][][][][][][][]
You store int's in the first two
[int][int][][][][][][][][][][][][]
Than you store struct RGB (A structure of 3 unsigned characters) in the remaining.
[int][int][sturct RGB][sturct RGB][sturct RGB][sturct RGB][sturct RGB]...
And you call this a surface.
Now when you call my sDrawSurface() function, you don't have to specify the width and height of the surface your drawing, because it already knows, because its already in the surface itself (My reason for doing it this way).
Its really just this simple.
The "Multiple of 3" rule is reference to the fact, that I cannot say arrSurface[{Some Decimal Value Here}] and get the height.
Observe...
struct RGB MyRGBArray;
MyRGBArray[0] == 0th byte.
MyRGBArray[1] == 3rd byte.
MyRGBArray[2] == 6th byte.
MyRGBArray[3] == 9th byte.
MyRGBArray[4] == 12th byte.
However, my the width and height are on the 0th byte && 4th byte.
And so I was hoping....
&MyRGBArray[0] + 4 == 4th byte.
However, it actually equals....
&MyRGBArray[0] + 4 == 12th byte.
Which is ludakris!