From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: how do I pass more than one value out of a function??? Date: Sun, 21 Jun 1998 12:39:54 -0700 Organization: Alcyone Systems Lines: 25 Message-ID: <358D618A.150C3E78@alcyone.com> References: 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 Andrew Deren wrote: > TO return several values just use: > > void foo(int& var1, char& var2, etc...) > > and then you call the function with the vars as regular function. > foo(myInt, myChar); Most people would suggest you pass pointers. This makes the code easily understandable and it's obvious what's being potentially modified and what's not. References in C++ were added to facilitate operator overloading, and became a standard part of the language. But under normal circumstances they should be used exceptionally sparingly (except when passing const references). -- Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com Alcyone Systems / http://www.alcyone.com/max/ San Jose, California, United States / icbm:+37.20.07/-121.53.38 \ Regret it? nope. / Said it? yep. / Ice Cube