Based on my answers to some comments on the question, as well as some other answers (and some of my own thoughts - but, in particular, not knowing any C language development process ...), I believe that this is a choice based only on the fact that people making this decision (Ritchie?) needed themselves.
If you interpret the indices of a multidimensional array as matrix indices, it makes sense to have the first index as the row index, and the second as the column index, i.e. column structure. If your applications will be heavy in linear algebra or other matrix matrix computations, it also makes sense to store these structures in such a way as to efficiently move them one column at a time, as many algorithms do. For this reason, programming languages ββsuch as Matlab and Fortran benefit from being the main columns - this makes it easy to write efficient code with matrices and matrix algorithms.
C, on the other hand, is much more versatile than, for example, Matlab or Fortran. Unless you intend to use int** specifically for matrices, it doesn't really matter which index it is. And naturally, if a is int** , then a[2] returns int* and a[2][1] returns int - you "dig deeper" into a multidimensional array. For efficiency, we now only care that if we select a[2] and want iteration, it must be cached efficiently. It doesnβt matter if you, a programmer, associate a[2] with a matrix row or column of a matrix - we do not work with matrices!
So there is no strong case (which I can make out from my head) for C to be primary. During the implementation of the first versions, it might have been easier to do this with a large number of lines - perhaps because the low-level base language (assembler?) Was already large in lines - and it was.
Tomas lycken
source share