Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!jato!mars!schmidt From: schmidt@mars.jpl.nasa.gov (Kevin Schmidt) Newsgroups: comp.lang.c Subject: Re: A question about typedef! Message-ID: <1990Nov20.210335.25763@jato.jpl.nasa.gov> Date: 20 Nov 90 21:03:35 GMT References: <1990Nov20.153907.12373@mathrt0.math.chalmers.se> Sender: news@jato.jpl.nasa.gov Reply-To: schmidt@mars.UUCP (Kevin Schmidt) Organization: Jet Propulsion Laboratory, Pasadena, CA. Lines: 21 Nntp-Posting-Host: mars.jpl.nasa.gov In article <1990Nov20.153907.12373@mathrt0.math.chalmers.se> d0thomas@dtek.chalmers.se (Thomas Lundqvist) writes: >Hello! Could someone please tell me the difference between: > >struct TEST { int a; }; > >typedef struct { int a; } TEST Both structures are identical but references to the structure as a type are different. For the first case to declare a variable of that type you would use: struct TEST x; In the second case you would simply use: TEST x; _______________________________________________________________________________ _ ____ _ | | / / / _ \ / / | Kevin T. Schmidt | schmidt@mars.jpl.nasa.gov / / / /_/ / / / | Jet Propulsion Laboratory | schmidt@jems.jpl.nasa.gov _ / / / ____/ / / | 4800 Oak Grove Dr. | / /_/ / / / / /___ | M/S 301-355 | \____/ /_/ /______/ | Pasadena, CA 91109 |