Column-wise data storage for matrices in C, any advantage(s)?

Scott Willingham willing at pantheon.seas.ucla.edu
Sat Feb 2 14:03:58 AEST 1991


In article <1991Feb1.214342.4982 at portia.Stanford.EDU> fangchin at elaine46.stanford.edu (Chin Fang) writes:
>...
>Now, note that this algorithm requires most rapid changes in indixing occuring
>in COLUMNS, not rows!
>
>I believe in default C design, data is stored in rows (discussed in K&R II)
>instead in columns.  It is almost very common these days people use 
>array of pointers to array as a way to simulate 2d matrices so that 
...

It seems to me that this is just a matter of syntax.  Whether you assign
the first or second _index_ of a C array to correspond to a matrix row
or column is arbitrary.  You just must be consistent in your usage
throughout the algorithm.

-- Scott D. Willingham



More information about the Comp.lang.c mailing list