Structure initialization rules question

Noemi Berry noemi at moscom.UUCP
Wed May 21 22:21:46 AEST 1986


	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"



More information about the Comp.lang.c mailing list