Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!usc!ucla-cs!heather From: heather@maui.cs.ucla.edu (Heather Burris) Newsgroups: comp.lang.c Subject: Re: mutual reference in structures Message-ID: <23608@shemp.CS.UCLA.EDU> Date: 5 May 89 00:54:26 GMT References: <6712@medusa.cs.purdue.edu> Sender: news@CS.UCLA.EDU Reply-To: heather@cs.ucla.edu (Heather Burris) Organization: UCLA Computer Science Department Lines: 30 In article <6712@medusa.cs.purdue.edu> bouma@cs.purdue.EDU (William J. Bouma) writes: >Please tell me how to get C to accept the following or equivalent code: > >typedef union a { > b_ *pb; >} a_; > >typedef struct b { > a_ va; >} b_; > > >-- >Bill || ...!purdue!bouma You cannot do forward references on typedefs. You can, however, on structure tags. Therefore you can say: typedef union a{ struct b *pb; }a_; typedef struct b{ a_ va; }b_; Note that the order of the above declarations is important because I have not removed the typedef reference to typedef a_. Have fun, Heather Burris, UCLA