how to pass an array as a parameter variable of the function ?

 

Dear All,

How to pass an array as a parameter variable of the function ?

I try like the example below, am I right ? example :

double Array1;

// add value inside the Array1 and so on.....

// call the ArrayDisplay function and pass the Array as a parameter variable of the function

ArrayDisplay(Array1);

//function and accept the variable parameter

void ArrayDisplay(array ArrayVariable1)
{
double DisplayList="";
for(int i=0;i<ArraySize(ArrayVariable1);i++)
{
DisplayList=DisplayList+" "+DoubleToStr(Array1Variable1[i],0);
}
Comment("Array1 Display\n",DisplayList);
Delay();
}

can some ones give me the guide of the passing array as a parameter. thanks for the help.

 

Sample

double Array1[100];
 
// add value inside the Array1 and so on.....
 
// call the ArrayDisplay function and pass the Array as a parameter variable of the function
 
 
//function and accept the variable parameter
 
void ArrayDisplay(double & Array[])
{
string DisplayList="";
for(int i=0;i<ArraySize(Array);i++)
{
DisplayList=DisplayList+" "+DoubleToStr(Array[i],0);
Array[i] = Array[i] + 2.0;
}
Comment("Array1 Display\n",DisplayList);
}
 
Rosh:

Sample


Thanks Rosh



rgsd bob

Reason: