From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: passing a structure?? Date: Wed, 12 Aug 1998 19:13:36 -0700 Organization: Alcyone Systems Lines: 29 Message-ID: <35D24BD0.D71EFDC@alcyone.com> References: <35D21F2A DOT FA2A98F2 AT xyz DOT net> NNTP-Posting-Host: charmaine.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Bjorn Hansen wrote: > Is it possible to pass a structure to a function ? Certainly. Note, though, that a function argument that is a structure is copied on the stack, which can cause problems if the contents of the structure reference dynamic data and the local members need to be kept in a consistent state with that data. Also, since C is pass-by-value, the entire structure must be pushed around on the stack. If the structures aren't really small, then this can waste time. > If so how would I > protorype it? struct S { ... }; extern int f(struct S s); /* returns int and takes a struct S */ -- Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900 Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/ USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE \ / But since when can wounded eyes see / Joi