Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!floyd!harpo!seismo!rlgvax!cvl!umcp-cs!chris From: chris@umcp-cs.UUCP Newsgroups: net.lang.c Subject: Re: 'struct' - declarations & parameters Message-ID: <5317@umcp-cs.UUCP> Date: Mon, 20-Feb-84 17:34:23 EST Article-I.D.: umcp-cs.5317 Posted: Mon Feb 20 17:34:23 1984 Date-Received: Tue, 21-Feb-84 08:09:33 EST References: <4033@edai.UUCP> Organization: Univ. of Maryland, Computer Science Dept. Lines: 32 Well first off, writing struct { int i, j, k; } foo = { 1, 2, 3 }; main () { printf ("%d %d %d\n", foo); } is just plain illegal. The bit about unions is also illegal. If you must pass a union, do something like union xyzzy { char *c; int i; }; main () { char *s; ... { union xyzzy temp; temp.c = s; strange (temp, 1); } ... } (This should be lots of fun for me: Gosling Emacs uses that union trick for the first parameter to DefMac. *Sigh*) As to whether the trailing semicolon is required in structure declarations: all I can say is it doesn't hurt to use it. (Though if you want type declarations to match function declarations, it should be optional. I don't have to write "dummy () { ; }".) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris.umcp-cs@CSNet-Relay