38613457@sdcc3.UUCP (38613457) (10/31/84)
fig() I here a lot about initializing unions, this is a pointer to a union, but the space it points to is big enough for aything that you should be able to put into it. Good, Bad, any better in the here now where I can play with them? As to ANSI, I would be happy if the compiler would cram whatever I choose to initialize into a space big enough to use for any of the members and position it for the type that it is. If the requires specific typecasting then ok, but here and now does anyone have something which looks better. Jim sdcsvax!sdcc6!ix269 {the 38613457 should be -$185 by oct 31 ) --------------------- mangle this line ------------------- #include <stdio.h> union Val { int oi; char oc; double od; }; typedef double BIG; tmpchar[sizeof(BIG)] = 'A'; struct Onion { int valtyp; union Val *val; } onion[] = { 1, (union Val *) tmpchar }; main() { extern Onion onion[]; printf("1, val = %c\n",onion->val->oc); onion->val->od = 3.1415927; printf("2, val = %lf\n",onion->val->od); onion->val->oi = 1; printf("3, val = %d\n",onion->val->oi); } /* eot */