title: Initializing variable in C++ function header
body: <p>I've come across some C++ code that looks like this (simplified for this post):</p>
  
  <p>(Here's the function prototype located in <code>someCode.hpp</code>)</p>
  
  <pre><code>void someFunction(const double &amp; a, double &amp; b, const double c = 0, const double * d = 0);
  </code></pre>
  
  <p>(Here's the first line of the function body located in <code>someCode.cpp</code> that <code>#include</code>'s <code>someCode.hpp</code>)</p>
  
  <pre><code>void someFunction(const double &amp; a, double &amp; b, const double c, const double * d);
  </code></pre>
  
  <p>Can I legally call <code>someFunction</code> using:</p>
  
  <pre><code>someFunction(*ptr1, *ptr2);
  </code></pre>
  
  <p>and/or</p>
  
  <pre><code>someFunction(*ptr1, *ptr2, val1, &amp;val2);
  </code></pre>
  
  <p>where the variables <code>ptr1</code>, <code>ptr2</code>, <code>val</code>, and <code>val2</code> have been defined appropriately and <code>val1</code> and <code>val2</code> do not equal zero? Why or why not?</p>
  
  <p>And if it is legal, is this syntax preferred vs overloading a function to account for the optional parameters?  </p>