In, Out, In/Out parameters
<p>I have a test coming up and I would like some clarification on two questions regarding parameters.</p>

<p>In my notes it states that the recommended way to pass a parameter to a function would be to use "pass by reference"</p>

<pre><code>    const type&amp; x; // for "in" parameters
    type&amp; x; // for "out"(to read) and "in/out"(to read/write) parameters
</code></pre>

<p>It also states for optional optimization, we can pass "in" parameters by value and we can also pass the out variable by reference instead of a simple return. </p>

<p>On the review question I'm trying to answer it states </p>

<blockquote>
  <p>Assume that all types are “moderate” size: Do not use the small-value optimization or the big-value optimization.</p>
</blockquote>

<p>Would the reference to "moderate size" mean I would use a pass by reference for "in" and "in/out" parameters as well as using basic return for "out" values?</p>

<p>Further more, there is a question that ask to create a prototype function (no body) that has the following:</p>

<blockquote>
  <p>IN : string a, C b<br>
  OUT : double d<br>
  IN/OUT : string d</p>
</blockquote>

<pre><code>    double foo (const string&amp; a, const C&amp; b, string&amp; d)
</code></pre>

<p>is what I have right now but I'm not sure how to handle the OUT and the IN/OUT since they are given the same name. Am I right to assume that a reference to the string could be passed into the function and a function like stod() is used to to generate a return of type double which can be stored in the calling function like </p>

<pre><code>    double val = foo(x,y,z)
</code></pre>