# Thread: 2D Arrays: Column/Row Order

1. ## 2D Arrays: Column/Row Order

I've noticed something odd in most of the books/tutorials I've read that deal with 2D arrays, including the current book I'm reading, Tom Swan's C++ Primer (1992).

From what I've read, in C++, the standard way to order the indicies is row#, column#.

The problem I have with that is that I think of coordinates in terms of (X, Y). Picking the ROW number first is effectively the same as picking the Y-coordinate; picking the column number is the same as picking the X-coordinate. This means that the coordinates are (Y, X), not (X, Y).

I find this confusing, and so I use (X, Y). The question is: Does this matter? If I order my array (x, y) instead of (y, x), will others be confused by my code? Which way should I use?

--Ashiq

2. Use whatever you like, as long as you use it that way consistently. There is no standard way of doing it (some libraries will do it one way, some the other, though this is usually a hidden implementation detail). If you think it might be confusing to someone (which I doubt), just put a comment in.