structure inits
galaxy%UCB-VAX at ucscc.UUCP
galaxy%UCB-VAX at ucscc.UUCP
Wed Jan 23 05:16:52 AEST 1985
Been wanting to know about local, global struct initialization.
I haven't seen this Q addressed; also, this may be an item for
all this discussion about standardization.
Q: Why is it ok to init a structure in line #7
but not local like in line #12 ?
---------------------------------------------------------------------
1 struct a {
2 int size;
3 char stuff[25];
4 short flag;
5 };
6
7 struct a item = { 256000, "Whatever", 1 };
8
9 any()
10 {
11 struct a item2 = item; /* no problem..... */
12 struct a bomb = { 128, "str", 1 }; /* no go for local */
13 }
----------------------------------------------------------------------
...using cc(1) on a Vax 780, running 4.2 BSD
Thanks.
Replies:
ucscc!galaxy at BERKELEY
galaxy%c%ucsc at csnet-relay
More information about the Comp.lang.c
mailing list