home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sdrc!thor!scjones
- From: scjones@thor.sdrc.com (Larry Jones)
- Newsgroups: comp.lang.c
- Subject: Re: Returned struct
- Message-ID: <2225@sdrc.COM>
- Date: 6 Nov 92 15:32:00 GMT
- References: <1992Nov5.075611.14809@piccolo.cit.cornell.edu>
- Sender: news@sdrc.COM
- Lines: 18
-
- In article <1992Nov5.075611.14809@piccolo.cit.cornell.edu>, sl14@crux3.cit.cornell.edu (Stephen Lee) writes:
- > How can one make use of a struct returned by a function? e.g.
- >
- > struct complex complex_add(struct complex a, struct complex b);
- >
- > I tried
- >
- > struct complex z1, z2, z3;
- > z3 = complex_add(z1, z2);
-
- That appears to be correct. Did you actually have a declaration of
- complex_add before the call? If not, the compiler would assume that
- it returned an int rather than a struct and would complain about
- trying to assign an int to a struct.
- ----
- Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070
- larry.jones@sdrc.com or ...uunet!sdrc!larry.jones
- We don't ATTEND parties, we just CRASH 'em. -- Calvin
-