structure references in header files

Richard Draves draves at harvard.UUCP
Fri Dec 13 03:27:36 AEST 1985


In general it is important to include the 'forward declaration':

	struct a;
	struct b { struct a *pa; };
	struct a { struct b *pb; };

This makes a difference when the declarations are inside a scope
that already can see a definition of 'struct a'.  For instance,

	struct a { ... };
	main()
	{
		struct b { struct a *pa; };
		struct a { struct b *pb; };
		...
	}

does not do what one might expect.

Rich
-- 

	"a picture in the head is a gory murder in an art gallery"

					-- Stephen Kosslyn



More information about the Comp.lang.c mailing list