An array in a structure Or an Array Of Structures

Chip Yamasaki chip at osh3.OSHA.GOV
Wed May 1 13:03:35 AEST 1991


In <1991May1.005354.3100 at milton.u.washington.edu> bytor at milton.u.washington.edu (Jill Patterson) writes:

>I would be interested in hearing your opinions on the differences between
>the two methods, optimization, modifying code later, ect..

I don't know about performance considerations, but I would code for
readability here.  I think the way to do that would be to consider the
way you are accessing them.  If you usually access them in pairs then
the large array of pairs would be more readable.  If they will be
accumulated in pairs, but accessed separately (in different parts or the
program or in different ways) I think the pair of arrays might (just
might) be more readable.

As a guess I would lean toward the array of pairs.

-- 
--
Charles "Chip" Yamasaki
chip at oshcomm.osha.gov



More information about the Comp.lang.c mailing list