X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Thu, 30 Aug 2007 19:37:08 -0400 Message-Id: <200708302337.l7UNb83E010710@envy.delorie.com> From: DJ Delorie To: djgpp AT delorie DOT com In-reply-to: (My_address AT end DOT of DOT post) Subject: Re: struct vs. typedef struct References: Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > I'm not sure whether this is a DJGPP question or a C question, It's a C question. > but I think the problem is due to the single-pass compilation of > DJGPP. Nope. > ... the compiler doesn't like it, I guess because when it encounters *next, > it hasn't seen the reference to S yet. typedet struct S1 { struct S1 *next; } S2; You can't use a typedef (S2) until after it's defined. You can use a struct (S1) without a full reference; a typedef like the above can include a struct definition (S1) and a "forward" struct usage (struct S1 ...). Normally, you'd use the same name for S1 and S2 in the example above.