how to pass a multidimensional array as a parameter

 

The code below is not working. Can I pass a multidimensional array as a parameter

double arr[][3];

void demofunc( double & arr[])

{

}
 
void demofunc( double & arr[][])
 
Alain Verleyen:
thanks it work.
 

Yes, And I get a strange error :

lopAIndex[2][];

'[' - invalid index value

Now why should this array not accept a dynamic size on the y?

Thank you. 

 

 

 
Alain Verleyen:

Hello,

I am trying to use the syntax in the answer above to create a function that can accept a two-dimensional array in MQL5, but the code below causes the following syntax error:

'[' - invalid index value


void demofunc( double & arr[][])
{

}

Note that I would like this function to accept a two-dimensional array whose second dimension length could be any value, so changing the code above to arr[][10] instead of arr[][] wouldn't work for me.

Does anyone know what I am doing wrong?

Thank you very much in advance,

Robox



 
Compiles fine with MT4 1045.
 
whroeder1:
Compiles fine with MT4 1045.

Hi @whroeder1 ,

Thank you for the info about MT4.  Unfortunately, I am using MT5 (build 1545) and it definitely doesn't compile for my version of MT5.

Do you or does anybody else know why this would work in MT4 but not in MT5?

What is the correct syntax for MT5, or is it even possible?

Thank you very much in advance,

Robox

 
Robox:

Hi @whroeder1 ,

Thank you for the info about MT4.  Unfortunately, I am using MT5 (build 1545) and it definitely doesn't compile for my version of MT5.

Do you or does anybody else know why this would work in MT4 but not in MT5?

What is the correct syntax for MT5, or is it even possible?

Thank you very much in advance,

Robox


I moved this question to its own thread ( https://www.mql5.com/en/forum/187666 ) since I posted it yesterday and there's still been no solution proposed for MT5.

Hopefully someone can help for the sake of all MT5 programmers, because a solution to this problem would be immensely powerful, moving MQL5 closer to MATLAB regarding matrix manipulation.

Please help: The following compiles in MT4 but not MT5: void demofunc( double & arr[][]) { }
Please help: The following compiles in MT4 but not MT5: void demofunc( double & arr[][]) { }
  • www.mql5.com
Hello, The following function compiles in MT4 (build 1045) (per @whroeder1 ), but not in MT5 (build 1545): Does anybody else know why this would co...
Reason: