[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing an Array to a function



PureBytes Links

Trading Reference Links

sure you can pass and return arrays
byref.
here is a sample from their workshop.
the function call...
value1 = SortDown_a(MyArray,25);
it takes myarray sorts it and returns
it sorted. 
and the function itself...
Inputs: SortArray[size](NumericArrayRef), ArraySize(Numeric);
Variables: Hold(0);

SortDown_a = -1;

If MinList(size, ArraySize) > 1 AND ArraySize <= size Then Begin
     For value1 = 1 To ArraySize - 1 Begin
          If SortArray[value1] < SortArray[value1 + 1] Then Begin 
                Hold = SortArray[value1]; 
                SortArray[value1] = SortArray[value1 + 1];
                SortArray[value1 + 1] = Hold;
               value1 = 0;
         End;
     End;
End;

SortDown_a = 1;


----- Original Message ----- 
From: Andrew Peskin <andrew@xxxxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Monday, July 24, 2000 9:46 AM
Subject: Passing an Array to a function


> Is it possible to pass an array to a function in Easy Language?
> 
> For example:  Suppose I have a 5 element Array named MyArray with the
> following values
> 
> MyArray[0] = 3;
> MyArray[1] = 4;
> MyArray[2] = 5;
> MyArray[3] = 6;
> MyArray[4] = 7;
> 
> and I want the average.  Is it possible to pass the entire Array to a
> function similar to VB or C/C++?
> 
> Such as the following call?
> 
>     Avg = CalcAvg(MyArray[],5)
> 
> Where CalcAvg is a function which accepts the array MyArray and the
> count value of 5 and then returns the average?
> 
> Thanks in advance for your help.
> 
> Andrew
>