title: C++ clarification of "return"
body: <p><strong>Homework, just advise please</strong></p>
  
  <p>Apparently my idea of what returning something in a method does is wrong.  I'm trying to write methods for getting derivatives of numbers and operations.  So far I just wanted to get the derivative of a non-negative number that isn't accompanied with an "x" (result should be zero no matter what value is given).</p>
  
  <p>The code is pretty long and needs to be cleaned up so I'll just include the method, the call, and what I'm getting.</p>
  
  <p>Method:</p>
  
  <pre><code>int noXDerivative(int tempInt, string tempX)
  {
      if (tempX == "")
      {
          tempInt = 0;
      }
      return tempInt;
  }
  
  void getDerivatives(int tempInt, string tempX, int tempInt2, string tempX2, char tempOperator)
  {
      noXDerivative(tempInt, tempX);
      noXDerivative(tempInt2, tempX2);
  }
  </code></pre>
  
  <p>The call:</p>
  
  <pre><code>getDerivatives(tempNumInt, tempNumX, tempNum2Int, tempNum2X, expression[iterator]);
  </code></pre>
  
  <p>I also called the "noXDerivative" directly to see what would happen but the result didn't change.  The test I'm running right now is "5 + 6" (tempNumInt is 5 and tempNum2Int is 6).  I keep getting 11 when I need to get 0 (again, there are no "x"s).  I was hoping that if I put tempNumInt as one of the parameters it would be changed from 5 to 0 within the noXDerivative method but it doesn't.  How do I correct this?</p>