structure initialization
Maarten Litmaath
maart at cs.vu.nl
Wed Jan 24 21:42:13 AEST 1990
In article <1515 at pttesac.UUCP>,
jeapedai at 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 at cs.vu.nl, uunet!mcsun!botter!maart
More information about the Comp.lang.c
mailing list