Specifying default parameter when calling C++ function
<p>Suppose I have code like this:</p>

<pre><code>void f(int a = 0, int b = 0, int c = 0)
{
    //...Some Code...
}
</code></pre>

<p>As you can evidently see above with my code, the parameters <code>a</code>,<code>b</code>, and <code>c</code> have default parameter values of 0. Now take a look at my main function below:</p>

<pre><code>int main()
{
   //Here are 4 ways of calling the above function:
   int a = 2;
   int b = 3;
   int c = -1;

   f(a, b, c);
   f(a, b);
   f(a); 
   f();
   //note the above parameters could be changed for the other variables
   //as well.
}
</code></pre>

<p>Now I know that I can't just skip a parameter, and let it have the default value, because that value would evaluate as the parameter at that position. What I mean is, that I cannot, say call, <code>f(a,c)</code>, because, <code>c</code> would be evaluated as <code>b</code>, which is what I don't want, especially if <code>c</code> is the wrong type. Is there a way for the calling function to specify in C++, to use whatever default parameter value there is for the function in any given position, without being limited to going backwards from the last parameter to none? Is there any reserved keyword to achieve this, or at least a work-around? An example I can give would be like:</p>

<pre><code>f(a, def, c) //Where def would mean default.
</code></pre>