www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/20/18:34:47

From: "Elias Pschernig" <f DOT x DOT gruber-museum-arnsdorf AT magnet DOT at>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how do I pass more than one value out of a function???
Date: Sat, 20 Jun 1998 22:01:18 +0200
Organization: magnet Internet Services
Lines: 26
Message-ID: <6mh9t5$m0d$1@orudios.magnet.at>
References: <358bfa94 DOT 0 AT news2 DOT ibm DOT net>
NNTP-Posting-Host: 195.3.67.188
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Sal schrieb in Nachricht <358bfa94 DOT 0 AT news2 DOT ibm DOT net>...
>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??

a simple thing to do this in C is using pointers (like in Pascal):

example:

void getposition(int *x,int *y)
{
 *x=5;
 *y=8;
}

void main(void)
{
 int a,b;
 getposition(&a,&b);
 // this will "return" 5 to a and 8 to b
}

hth,
Elias Pschernig


- Raw text -


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