Path: utzoo!mnetor!uunet!husc6!hao!ames!ucsd!hub!angst%csilvax From: angst%csilvax@hub.ucsb.edu (The Stinkpuff) Newsgroups: comp.lang.c Subject: Re: struct a <---> struct b Message-ID: <341@hub.ucsb.edu> Date: 7 Feb 88 01:40:41 GMT References: <173@heurikon.UUCP> Sender: news@hub.ucsb.edu Reply-To: angst%csilvax@hub.ucsb.edu Organization: ///Club Angst!\\\ Lines: 36 In article <173@heurikon.UUCP> lampman@heurikon.UUCP (Ray Lampman) writes: >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@heurikon.UUCP) I'm not sure what you mean by a forward referencing error. Since all pointers are the same size, the compiler shouldn't care if it doesn't yet know the object that is being pointed to. The following program compiles fine on my machine (a VAX running 4.3BSD) -- struct a { struct b *bp; /* forward reference */ struct c *cp; /* ditto */ int other_stuff; }; struct b { struct a *ap; struct c *cp; /* forward reference */ int other_stuff; }; struct c { struct a *ap; struct b *bp; int other_stuff; }; main ( ) { } Dave Stein "Life's a clambake." ARPA: angst%csilvax@hub.ucsb.edu Disclaimer: college students don't UUCP: ...ucbvax!hub!csilvax!angst need no disclaimers!