Newsgroups: comp.os.msdos.djgpp From: Peter Berdeklis Subject: Re: Labelled array display element funny Message-ID: Nntp-Posting-Host: chinook.physics.utoronto.ca Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator) Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: University of Toronto - Dept. of Physics In-Reply-To: Date: Fri, 11 Oct 1996 21:01:43 GMT References: <7E03B4350B AT fs2 DOT mt DOT umist DOT ac DOT uk> <53gjj8$5l7 AT mark DOT ucdavis DOT edu> Lines: 31 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On Wed, 9 Oct 1996, Chris Waters wrote: > In article <53gjj8$5l7 AT mark DOT ucdavis DOT edu>, > Jeffrey Taylor wrote: > >A.Appleyard (A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk) wrote: > >: What have I done wrong here? Or can't I use array element labels when the > >: elements are subarray displays? > > > >Correct. You cannot use array labels in C initializers. > > Unless you're using gcc. And gee, guess what? :) > > The correct answer is that if you have an array of structures, you must > name the structure fields in your initializers: > > craft dsub[128]={ > [1] {codeno: "CH79", name: "Aphanistor"}, > [55] {codeno: "DS1 ", name: "Quackers"}, > [56] {codeno: "DS2 ", name: "Donald"}, > [23] {codeno: "BA32", name: "Big Jim"}, > [35] {codeno: "FA65", name: "Trelawney"}}; Note that this is not available in gnu C++ (according to the info files :), so if you've tried compiling this with gxx it still will not work. Pete --------------- Peter Berdeklis Dept. of Physics, Univ. of Toronto