quick array question
Ive never really thought about it but when you declare a 2d array, which number is for the vertical size and which is for the horizontal e.g.
does int array[5}[2]; create this
xxxxx
xxxxx
or this
xx
xx
xx
xx
xx
I dont think it really matters as long as you always refere the same way but I was wondering if anyone knows of a situation where it would matter?
There isn't anywhere it would matter unless you're doing something extremely sick like going out of bounds on the second dimension to access another first dimension. There's really no way to visualize it unless you say the first dimension is X, the second is Y... in memory they're just a bunch of contiguous bytes.
depends on how you go through it... Mostly i would go y x.... easier for reading.. y x as in int array [y][x];
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement