Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!seismo!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP Newsgroups: comp.lang.c Subject: Re: Initialization of a two-dimen. array of structures. Message-ID: <702@mcgill-vision.UUCP> Date: Sun, 22-Mar-87 04:38:36 EST Article-I.D.: mcgill-v.702 Posted: Sun Mar 22 04:38:36 1987 Date-Received: Fri, 27-Mar-87 05:41:46 EST References: <2173@ncoast.UUCP> Distribution: comp Organization: McGill University, Montreal Lines: 42 In article <2173@ncoast.UUCP>, simpsong@ncoast.UUCP (Gregory R. Simpson @ The North Coast) writes: > struct of_stuff { > char *name > float value; > float another; > int counter; > } > > stuff[20][30] = { > { > "joe", 1, 0, 12, > [...] > This works fine on VMS 4.5 (VMS C - 4.?) and on my PC using MS C 3.0. > However, when I tried it on a vax 11/780 running 4.3BSD and a Sun > workstation running whatever they call Unix (the latest 3.0 I > believe), I got an error. The error was repeated 4 times for each > line that has a name in it (like "joe"), the error said I was missing > a }. (or something to that effect.) I copied the code from your posting and tried compiling it on 4.3. It produced three errors for each initialization line, the error saying "} expected". This leads me to believe that you were actually trying to compile the above code. This is important because what you posted is missing a semicolon on the first element of the structure!! In fact, the *first* error message the compiler produced complained about this. Generally, you should fix the first error first. Then run through the rest of the errors, fixing any that seem reasonable and forgetting about any that don't seem to make sense. This is because, as in this case, one error can cause may others - this is termed "floodgating". Bright note: you do have the initialization syntax right. (I could argue about the placement of the braces, but style has nothing to do with the *correctness* of the code.) der Mouse Smart mailers: mouse@mcgill-vision.uucp USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!musocs!mcgill-vision!mouse think!mosart!mcgill-vision!mouse ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu