Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.lang.c Subject: Re: structure initialization Message-ID: <5190@solo8.cs.vu.nl> Date: 24 Jan 90 10:42:13 GMT References: <1515@pttesac.UUCP> Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatika, Amsterdam, the Netherlands Lines: 39 In article <1515@pttesac.UUCP>, jeapedai@pttesac.UUCP (J. E. Apedaile) writes: \... \"e.c", line 17: too many struct initializers \... \struct exp1 { \ int length; \ long grp1; \ long grp2; \}; \ \typedef struct { \ struct exp1 blk[5]; \} RANGE; \ \ \main() \{ \ static RANGE example = { \ { 40, 0xcf000, 0xff000 }, \ { 50, 0x1cf000, 0x1ff000 }, \ { 60, 0x2cf000, 0x2ff000 }, \ { 70, 0x3cf000, 0x3ff000 }, \ { 80, 0x4cf000, 0x4ff000 }, \ }; Too many initializers indeed! I think you can figure out why the following is correct: static RANGE example = {{ /* note the `extra' brace! */ { 40, 0xcf000, 0xff000 }, { 50, 0x1cf000, 0x1ff000 }, { 60, 0x2cf000, 0x2ff000 }, { 70, 0x3cf000, 0x3ff000 }, { 80, 0x4cf000, 0x4ff000 }, }}; /* ...and its match */ -- What do the following have in common: access(2), SysV echo, O_NONDELAY? | Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart