delorie.com/archives/browse.cgi | search |
Message-ID: | <37B16FAE.79807BE8@flash.net> |
From: | Matt McLelland <mattpi AT flash DOT net> |
X-Mailer: | Mozilla 4.51 [en] (Win98; U) |
X-Accept-Language: | en |
MIME-Version: | 1.0 |
Newsgroups: | comp.os.msdos.djgpp,comp.graphics.algorithms |
Subject: | Re: struct problem... structs within struct |
References: | <A7083B60FEDED7E0 DOT 7F2CBC07CD9B5AB8 DOT 019CE2E485CE12C4 AT lp DOT airnews DOT net> <37AF5947 DOT 66951F05 AT NOSPAMthepentagon DOT com> <8432818566957DB4 DOT DF5776918DB4D437 DOT AD3715803EC19E27 AT lp DOT airnews DOT net> <37B0847D DOT 60A75CAB AT NOSPAMthepentagon DOT com> <615620E39BE81788 DOT CF8A6B1990FBBD97 DOT C41A8FB435290DCC AT lp DOT airnews DOT net> |
Lines: | 36 |
Date: | Tue, 10 Aug 1999 23:35:14 GMT |
NNTP-Posting-Host: | 209.30.70.32 |
X-Complaints-To: | abuse AT flash DOT net |
X-Trace: | news.flash.net 934328114 209.30.70.32 (Tue, 10 Aug 1999 18:35:14 CDT) |
NNTP-Posting-Date: | Tue, 10 Aug 1999 18:35:14 CDT |
Organization: | FlashNet Communications, http://www.flash.net |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Matthew Heyman wrote: > All right.... digging through my code and came up with a possible > realization. In several instinces I use structs within structs. Is > this possible? Consider the following piece of code... > > typedef struct > { > int x; > }point; > > typedef struct > { > point loc; > }vert; > > point p1; > p1 = 2; I assume you meant p1.x=2 here, > vert v1; > v1 = p1; and v1.pointloc = p1 here. > //and to access the final point within the vert > cout <<v1.loc.x<<endl; > > Is my logic messed up? Can I even do this in? This is the second time you have posted code snippets which contain code to be executed outside of function scope. You can't put lines like a=b outside of a function. You can initialize a variable with a value, but that must be done on the line in which the variable is declared.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |