Initialization of a two-dimen. array of structures.

simpsong at ncoast.UUCP simpsong at ncoast.UUCP
Sat Mar 14 11:29:20 AEST 1987


*** Line eater food ***

I have a structure like this:
===============================

struct of_stuff {
char *name
float value;
float another;
int counter;
}

stuff[20][30] = {
     {
        "joe", 1, 0, 12,
        "fred", 1, 0, 13,
        "carol",1, 0, 4 }
     ,
     { 
        "joe", 1, 0, 12,
        "fred", 1, 0, 13,
        "carol",1, 0, 4 }
     }

======================================

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.)

My question is: What is the proper way to initialize a two dimensional
array of structures...

Thanks for any help, I thought I had it right till I tried BSD...

Greg

-- 
      Gregory R. Simpson       

UUCP: {ihnp4, seismo, decwrl, philabs, ucbvax}!decvax!cwruecmp!ncoast!simpsong
CSNET: ncoast!simpsong at case.CSNET     
ARPA:  ncoast!simpsong%case.CSNET at Csnet-Relay.ARPA



More information about the Comp.lang.c mailing list