structure references in header files

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Thu Dec 12 01:16:14 AEST 1985


OOPS!  Please ignore my previous posting on this, which
had the member types misdeclared.  The idea was right but
I was distracted while typing it.  Here is the correct version:


The approved way to declare two structs each of which has a
member that is a pointer to the other type of struct, is:

struct a;

struct b {
	struct a *ap;	/* BUG FIX */
	};

struct a {
	struct b *bp;	/* BUG FIX */
	};

Yes, I know it looks unbelievable.  This kludge is present
precisely to handle this kind of problem.



More information about the Comp.lang.c mailing list