struct a <---> struct b

Doug Gwyn gwyn at brl-smoke.ARPA
Mon Feb 8 22:56:22 AEST 1988


In article <173 at heurikon.UUCP> lampman at 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.

struct b;	/* incomplete types for forward reference */
struct c;

struct a { struct b *bp; struct c *cp; } as;
struct b { struct c *cp; struct a *ap; } bs;
struct c { struct a *ap; struct b *bp; } cs;



More information about the Comp.lang.c mailing list