home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!stanford.edu!morrow.stanford.edu!camis.Stanford.EDU!ehh
- From: ehh@camis.Stanford.EDU (Edward H. Herskovits)
- Newsgroups: comp.programming
- Subject: Mutual reference in C?
- Date: 8 Nov 1992 15:16:45 GMT
- Organization: Stanford University School of Medicine
- Lines: 24
- Message-ID: <1djb0tINNa9t@morrow.stanford.edu>
- NNTP-Posting-Host: camis.stanford.edu
-
-
- simple question to which i couldn't find an answer in standard c books:
- if there are two structures, a and b, that refer to each other,
- struct {
- ...
- b *bPtr;
- ...
- } a;
-
- and
-
- struct {
- ...
- a *aPtr;
- ...
- } b;
-
- how can i declare these two structures such that they can refer to pointers
- of each other? i know that self-referential structures can be declared with
- tags, but i can't get these declarations to compile no matter how i modify
- them. i know that in pascal (ugh) i could use the "forward" keyword; what
- would be the equivalent thing to do in c?
- please reply by email, since it's probably not of general interest.
- -eddie
-