struct a <---> struct b

Roland McGrath rk9005 at cca.ucsf.edu
Sun Feb 7 09:30:22 AEST 1988


["struct a <---> struct b"] - lampman at heurikon.UUCP (Ray Lampman):
} What is the best way to declare three different structures,
} each containing a pointer to the other two?
} I keep running into a forward referencing error.
} I'm looking for a solution without typedef's, I'll add those later.
} aTdHvAaNnKcSe, Ray.
} -- 
}                                         - Ray Lampman (lampman at heurikon.UUCP)

Try:
	struct a;
	struct b;
	struct c;
	struct a { struct b *bp; struct c *cp; };
	struct b { struct a *ap; struct c *cp; };
	struct c { struct a *ap; struct b *bp; };

-- 
		Roland McGrath
UUCP: 			...!ucbvax!lbl-rtsg.arpa!roland
ARPA:	 		roland at rtsg.lbl.gov



More information about the Comp.lang.c mailing list