Download MetaTrader 5
To add comments, please log in or register
Do you wonder how to use widgets? Read the article!
HarriMQL5
351
HarriMQL5 2016.11.02 18:52 

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
6578
Carl Schreiber 2016.11.02 20:44  
You can't get/access/write slices of arrays - only single elements.
Fstrifoerr8
36
Fstrifoerr8 2016.11.03 23:20  

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