View Single Post
  #3 (permalink)  
Old 02-06-2006, 09:42 AM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow Return an array

Quote:
Originally Posted by charliev

Hello all,

With all the questions I've been posting, it's obvious I'm a newbie... thanks for all the help.

I'd like to create a FUNCTION that returns an ARRAY, but not sure of the syntax. I tried this:

double function_name[] (double var1, double var2)
{
// do something to create array here
}

But it didn't like the square brackets.

Also, how do you DECLARE and INIAILIZE a 2 dimentional array?

Thanks for the help!
-charliev

charliev,

You can not return an ARRAY the way you wrote your code:

To return an array use code like this:

PHP Code:
void function_name (doubleMyArray[], double var)
   {
   
//Fill MyArray with the elements you want.
  //Don't use RETURN keyword
   

__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Reply With Quote