🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #1104

Re: Wzajemna referencja struktur.

#1104
From: Karpierz
Date: Thu, 29 Jan 1998 19:04
45 lines
1563 bytes
Adam Bienias <souadam@polbox.com.pl> napisal
> Mam problem ktorego jakos nie moge rozwiazac. 
> Potrzebuje zdefiniowac
> dwie struktury, przy czym kazda moze wskazywac na 
> druga:
> 
> typedef struct {
>    BETA_STRC  *hans;	
> } ALFA_STRC;
> 
> typedef struct {
>    ALFA_STRC  *kloss;	
> } BETA_STRC;
> 
> Jak to zrobic ?

Ja w takim przypadku stosuje konstrukcje:

/* deflaracje typu forward */

struct ALFA_S;	// wiem ze nadmiarowo ale nie zaszkodzi i jest symetrycznie
struct BETA_S;

/* deklaracje struktur */

struct ALFA_S
{
  struct BETA_S * brunner;
};

struct BETA_S
{
  struct ALFA_S * shtetke;
};

/* deklaracje typedef */   // pozwalaja opuszczac slowo struct przy
deklaracjach            

typedef struct ALFA_S  ALFA_STRC;
typedef struct BETA_S  BETA_STRC;

-- 
Pozdrawiam                                         Adam Karpierz   
mailto:karpierz@intertele.pl
http://www.intertele.pl/users/karpierz 
Technical Details
Message-ID: <01bd2ce8$c83cbb20$8ebaccc2@karpierz.dyn.ml.org>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!ict.pwr.wroc.pl!not-for-mail
References: <34D0AA82.46D7@polbox.com.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!ict.pwr.wroc.pl!not-for-mail
From: "Karpierz" <karpierz@inter.intertele.pl>
Newsgroups: pl.comp.lang.c
Subject: Re: Wzajemna referencja struktur.
Date: 29 Jan 1998 19:04:27 GMT
Organization: Technical University of Wroclaw, Poland
Lines: 49
Message-ID: <01bd2ce8$c83cbb20$8ebaccc2@karpierz.dyn.ml.org>
References: <34D0AA82.46D7@polbox.com.pl>
NNTP-Posting-Host: ppp142.intertele.pl
X-Newsreader: Microsoft Internet News 4.70.1161
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit