Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!thyme!kaleb From: kaleb@thyme.jpl.nasa.gov (Kaleb Keithley) Newsgroups: comp.lang.c Subject: Re: typedefs that need each other Message-ID: <1991Jan15.190445.24609@thyme.jpl.nasa.gov> Date: 15 Jan 91 19:04:45 GMT References: <26261@uflorida.cis.ufl.EDU> Distribution: usa Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 40 In article burley@geech.ai.mit.edu (Craig Burley) and by inference jdb@reef.cis.ufl.edu (Brian K. W. Hook) wrote: > Scenario: > > typedef struct _struct1 { > ..... > STRUCT2 *structure; > ..... > } STRUCT1; > > typedef struct _struct2 { > ..... > STRUCT1 *structure; > ..... > } STRUCT2; > K&R2 in section 6.7 Typedef (on page 146) shows exactly how to do this with typedefs, and the above example would be: typedef struct _struct2 *STRUCT2ptr typedef struct _struct1 { ..... STRUCT2ptr structure; ..... } STRUCT1; typedef struct _struct2 { ..... STRUCT1 *structure; ..... } STRUCT2; -- Kaleb Keithley Jet Propulsion Labs kaleb@thyme.jpl.nasa.gov Offensive quote coming soon to a .signature file near you.