Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: Re: Union initialization Message-ID: <398@twwells.uucp> Date: 18 Feb 89 18:46:19 GMT References: <816@atanasoff.cs.iastate.edu> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 25 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <816@atanasoff.cs.iastate.edu> hascall@atanasoff.cs.iastate.edu (John Hascall) writes: : : Does 'ANSI' C allow for union initialization? Yes, two ways: 1) Initializing via the first member: union FOO { int bar; char *gak; } Bletch = { 42 }; 2) Initializing from a union of compatible type: func() { union FOO frab = Bletch; Note the brace use: braces are required for the first way and forbidden for the second. --- Bill { uunet!proxftl | novavax } !twwells!bill