Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!seismo!rochester!ritcv!moscom!noemi From: noemi@moscom.UUCP (Noemi Berry) Newsgroups: net.lang.c Subject: Structure initialization rules question Message-ID: <696@moscom.UUCP> Date: Wed, 21-May-86 08:21:46 EDT Article-I.D.: moscom.696 Posted: Wed May 21 08:21:46 1986 Date-Received: Sat, 24-May-86 04:08:48 EDT Distribution: net Organization: MOSCOM Corp, E Rochester, NY, USA Lines: 36 Why is it that you can only initialize structures when they are global (outside of main() )? If you initialize a structure within a function you get an "No auto. aggregate initialization" error. I don't see anywhere in K&R where the structure initialization rules are explained. e.g.: *--------------------- Compiles struct XX { int i; } xx = { 0 }; main() { } ------------------------------* *--------------------- Doesn't compile main() { struct XX { int i; } xx = { 0 }; } -------------------------------------* Is there some good reason for this? (Is it a language inconsistency?) Is there something obvious I'm missing here?! noemi ----------- noemi berry {allegra|decvax|seismo}!rochester!moscom!noemi "On a souvent besoin de plus petit que soi"