struct a <---> struct b
Alan_T._Cote.OsbuSouth at Xerox.COM
Alan_T._Cote.OsbuSouth at Xerox.COM
Fri Feb 12 06:23:41 AEST 1988
Finally -- one I can answer!!
>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.
Try declaring all three as externals ahead of time. Try the following:
struct s
{
struct s *p0;
struct s *p1;
};
extern struct s a;
extern struct s b;
extern struct s c;
struct s a = { &b, &c };
struct s b = { &a, &c };
struct s c = { &a, &b };
How's that?!?
More information about the Comp.lang.c
mailing list