arstrube's blog

Optional Function Parameters?

Hello,

The MT4 documentation says you can create a function with optional parameters thus:


void example (int a, int b=0);

Then, according to the documentation, it should be possible to call the function thus:


example (15);

and 0 should be substituted for the second argument. Instead, I keep getting the error:


')' wrong parameter count.

What am I overlooking here? Is there any documentation or book that is more detailed than the MT4 online documentation, maybe?

Oh, and here a very important detail. The problem occurs only if the function is external, residing in a library file, and the above declaration is in an mqh file. The library file will compile fine, but the error occurs in the calling expert.

XML feed