Re: Feedback on C code?
@70
I'm not sure what you're saying exactly, but in general, given:
array[a][b][c][d][[e][f]...[z];
Indexes further to the right increase the fastest. In a 2d array the second index going up by 1 moves you forward 1 element. In a 3d array the 3rd going up by 1 moves you one element forward. If you want to match what the C compiler is doing and x is first, it's x*height+y because y "increases the fastest" as you move up in memory (I did not choose the term increases the fastest; this is just what everyone uses. But if you think about it it will make some sense). If it's y first, then it's y*width+x. The rightmost index is always added with no multiplier, and as you move left you multiply by the size of what's to the right in the type.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector