I've spent the past day of down time percolating (and steaming) about this question. Maybe I shouldn't feel so strongly about it but I do.
There are really two questions in this thread. One is about the correct answer to MGrancey's exam, and the other is about how to think about 2-dimensional arrays.
MGrancey, the "correct answer" of char X[40][10] is absolutely wrong and you should dispute it. It doesn't even agree with your teacher's visualization of array[y][x]. Actually, it's perfectly appropriate to visualize an array that way, as cartesian coordinates on a graph, because that implies that the first dimension represents rows and the second dimension represents columns. Under that assumption, it naturally follows that the 10 words with 40 characters would be laid out as
Code:
thisisthefirstwordblabla................
thisisthesecondwordblablabla............
thisisthethirdword......................
....
(7 more rows)
...
and as Daved said, there is no doubt that an array of c-strings or an array of string literals is laid out as above.
Using the exam answer of char X[40][10] with 40 as the y dimension we would have
Code:
tttttttttt
hhhhhhhhhh
iiiiiiiiii
ssssssssss
iiiiiiiiii
ssssssssss
tttttttttt
hhhhhhhhhh
eeeeeeeeee
ffffffffff
..........
(30 more rows)
..........
which would be ridiculous unless you're writing in Chinese.
Regarding rows and columns in general, Daved and brewbuck, if you're talking about arrays of more than 2 dimensions I'll agree that referring to a particular dimension as rows, columns, slices, or whatever you want to call them has no intrinsic meaning. There is no particular convention in that case and its fine to interpret them in any way that makes sense for the application. The only objective "rule" is that to optimize the running of the program it's important that iterating through the last dimension corresponds to accessing data that is LOGICALLY contiguous. That depends entirely on the application.
But in 2 dimensions there is a very definite, well-established convention - the first dimension is the "rows" dimension and the second is the "columns dimension. I'd like to call this a universal convention, but apparently this discussion by itself would prove me wrong. But if we call the 2-dimensional array a matrix, then I'd be on pretty solid ground calling it a universal convention. I strongly doubt that you can find any math book that would contradict the statement that a 3 x 2 matrix has 3 rows and 2 columns. If you like to read with your head turned sideways, and turn your matrix that way too so the first row runs vertically down the right side of the page, fine, but you'd better still call it a row because otherwise you'll be making it difficult and confusing to communicate with others about it.
Every time I've read anything about 2D arrays in a programming textbook (not a language reference manual), they call the first dimension the "rows" dimension and the second the "columns". For example, it is that way in K&R, in King's C Programming - A Modern Approach, in Lippman & Lajoie's C++ Primer -- those are all I have handy. Even in Fortran tutorials, (google "Stanford fortran tutorial") 2D arrays are described this way, despite the fact that Fortran lays out the first dimension contiguously in memory. This works fine. In Fortran you simply set up your loops with the inner loop on the first dimension, and iterate through one column, then the next, and so on.
I don't think this is anything like arguing about endianness. I don't care how a compiler stores an array in memory. This question really has very little to do with how the array is stored in memory. It's mostly a language convention (I mean natural language, not programming language). If we have a convention that makes communication easier, why fly in the face of it? Conventions like this let the next person understand what we wrote or said without wasting time on unnecessary explanations, and make it much easier for someone else to understand your code. If the data is such that it is natural to think of it as being arranged in rows and columns (such as pixels in a image, for example), I think this is a very compelling reason to set up the array as Array[rows][columns] and I would try to organize the data and the implementation so that it will be accessed row by row, unless there is a compelling reason to do otherwise.