Download MetaTrader 5

Array of arrays access

To add comments, please log in or register
HarriMQL5
349
HarriMQL5  

Hello

I have an array of arrays of ints. I want to access a particular sub-array but compiler says: "Invalid array access". What am I doing wrong?

Please Note: I do NOT want to access individual elements of the sub-array


int             pattern[2][2] = {{-1,1},{1,-1}};

....

    int lTarget[] = pattern[0,0];
    if (gridObj.PatternMatch( lTarget) && !trig[idx[1]]) {

Carl Schreiber
7087
Carl Schreiber  
You can't get/access/write slices of arrays - only single elements.
Fstrifoerr8
36
Fstrifoerr8  

Only arrays created in global space can be initialize some number and can have size.

Try like this.

 

int lTarget[];

ArrayResize(lTarget,1);

lTarget[0] = pattern[0,0];
To add comments, please log in or register