Argument passimg in MQL4

To add comments, please log in or register
karan
52
karan  
I know C/C++ and find the syntax of MQL4 to be compatible with C, However there are annoying differences such as not being able to do a pre decrement operator (--pos), etc.

How do you pass arguments to functions that modify the arguments. In C you can use pointers and in C++ you can additionally use a ref type. Is there any equivalent in MQL4?
cockeyedcowboy
524
cockeyedcowboy  
karan:
I know C/C++ and find the syntax of MQL4 to be compatible with C, However there are annoying differences such as not being able to do a pre decrement operator (--pos), etc.

How do you pass arguments to functions that modify the arguments. In C you can use pointers and in C++ you can additionally use a ref type. Is there any equivalent in MQL4?
use the '&' symbol in your parameter descriptions at the function level. Example

void MyFunction( int& count )
{
count = count + 1;
return;
}

What ever argument you pass this function it will get incrimented by one.
karan
52
karan  

use the '&' symbol in your parameter descriptions at the function level. Example

void MyFunction( int& count )
{
count = count + 1;
return;
}

What ever argument you pass this function it will get incrimented by one.
Thanks. Looks like they use the C++ ref syntax.
To add comments, please log in or register