Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!milton!bytor From: bytor@milton.u.washington.edu (Jill Patterson) Newsgroups: comp.lang.c Subject: An array in a structure Or an Array Of Structures Message-ID: <1991May1.005354.3100@milton.u.washington.edu> Date: 1 May 91 00:53:54 GMT Sender: bytor@milton.u.washington.edu (Jill Patterson) Organization: University of Washington, Seattle Lines: 62 I hope someone out on the net can help me with this. What I have is a group of nested structures that contain information like the following: Cell 1, Cell 2, ..., Cell n +--Main Struct--+ |+-Sub Struct-+| || Data || --> array[0], array[1], ..., array[n-1] ] |+-------------+| |+-Sub Struct-+| || Data || --> array[0], array[1], ..., array[n-1] |+-------------+| +---------------+ should i declare it like the following. struct SubA { int Array[n]; } struct SubB { int Array[n]; } struct Main { SubA sub_a; SubB sub_b; }; or like this struct SubA { int value; } struct SubB { int value; } struct Main { SubA sub_a; SubB sub_b; } Main MyMain[n]; I would be interested in hearing your opinions on the differences between the two methods, optimization, modifying code later, ect.. Thanx So Much -Jill Patterson -Jill bytor@milton.u.washington.edu .