• Sign up >>

assignment to an array

To add comments, please log in or register
Dror Yona
21
Dror Yona  

I'm trying to assign as follows (without using copyarray):

array1[i]=array2[j];

or

array1[i]=array2[j]+array2[k];

where i,j and k are integers, array1 and array2 are declared as double, and array2 contains values different from 0.
Somehow array1 remains 0 after the assignment.

Where did I go wrong?

Slava
Moderator
13386
Slava  
Please show sample of code. 1 line is not sample
Dror Yona
21
Dror Yona  
stringo wrote:
Please show sample of code. 1 line is not sample
Hope it will clarify the idea:

void example()
{
double a1[][6],a2[][6];
int i;

ArrayCopyRates(a1,"EURUSD", PERIOD_H1); // this line works fine

for (i=0;i<=100,i++)
a2[i][4]=a1[101-i][4]+a2[i][4]/5; // this is totally hypothetical but return zeros to a2
}
Slava
Moderator
13386
Slava  
First dimension of array must be declared explicitly

double a1[][6],a2[101][6];
Dror Yona
21
Dror Yona  
You were right. Thank you!
To add comments, please log in or register