www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/20/16:40:49

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how do I pass more than one value out of a function???
Date: Sat, 20 Jun 1998 16:24:38 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 27
Message-ID: <358C1A86.CE15E3FB@cs.com>
References: <358bfa94 DOT 0 AT news2 DOT ibm DOT net>
NNTP-Posting-Host: ppp120.cs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Sal wrote:
> 
> I come from a pascal background... anyway, I know how to use a fundtion to
> ruturn a value.  What do I do to mave something that ruturns several
> values??

I recommend asking questions like these on comp.lang.c; it's for
C-specific issues, not DJGPP specific ones.

You return multiple values from a C function in precisely the same way
you do it in Pascal; you pass pointers to the variables you want to
alter as arguments to the function and modify those values.  Pascal
refers to this as VAR passing; it has the same effect.  You can also
create a struct to hold the values and return that from the function.

Please read a good C textbook such as _The New C Primer Plus, 2nd
Edition_, by Waite & Del Prata, or Kernighan and Ritchie's _The C
Programming Language, 2nd Edition_.  Both are extraordinarily
well-written and will give you all the information you need.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | History has the relation to truth    |
|       aka Fighteer I       | that theology has to religion--i.e., |
|   mailto:fighteer AT cs DOT com   | none to speak of.                    |
| http://www.cs.com/fighteer |                    -Lazarus Long     |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019