cvs.gedasymbols.org/archives/browse.cgi | search |
From: | Mark van der Aalst <flux AT stack DOT nl> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: passing a structure?? |
Date: | 13 Aug 1998 03:32:53 +0200 |
Organization: | Eindhoven University of Technology, The Netherlands |
Lines: | 35 |
Sender: | flux AT toad DOT stack DOT nl |
Message-ID: | <6qtfo5$5nd$1@toad.stack.nl> |
References: | <35D21F2A DOT FA2A98F2 AT xyz DOT net> |
NNTP-Posting-Host: | toad.stack.nl |
User-Agent: | tin/pre-1.4-980730 (UNIX) (FreeBSD/2.2.6-STABLE (i386)) |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Bjorn Hansen <viking AT xyz DOT net> wrote: > Is it possible to pass a structure to a function ? If so how would I > protorype it? typedef struct { int blah; float bar; } foo_t ; /* pass by reference */ void my_funcie1(foo_t * foo) { foo -> blah = 12; } /* pass by value (generally slower) */ void my_funcie2(foo_t foo) { foo.blah = 12; } int main(void) { foo_t bar; my_funcie1(&bar); my_funcie2(bar); return 0; } Cheers, flux.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |