Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!unido!pbinfo!corona!db2 From: db2@pbinfo.UUCP (Vorl. Informationssysteme) Newsgroups: comp.lang.c Subject: Re: Using data types before they are declared. Message-ID: <548@corona.pb> Date: 14 Jun 89 08:55:18 GMT References: <10268@watcgl.waterloo.edu> Organization: Uni-GH Paderborn, Germany Lines: 38 In article <10268@watcgl.waterloo.edu> awehrmann@watcgl.waterloo.edu (August Wehrmann) writes: >I have a question: > >Is it possible, (and if so, how?), to use a data type in a declaration >of say, a union, that has not yet been declared? > >[Example omitted] > >union Fred { <-------- > int Number; | > element Node; <........... >}; | . > | . >typedef struct { | . > int Info; | . > Fred Name; <-------- . >} *element; <........... > >Thanks in advance. > I would use the following: union Fred { int Number; struct _el_str *Node; }; struct _el_str { int Info; Fred Name; }; typedef struct _el_str *element; I am practising this in my own programs very often. D. Aedal YACSS (Yet Another CS Student)