title: How do I use Reference Parameters in C++?
body: <p>I am trying to understand how to use reference parameters. There are several examples in my text, however they are too complicated for me to understand why and how to use them.</p>
  
  <p>How and why would you want to use a reference? What would happen if you didn't make the parameter a reference, but instead left the <code>&amp;</code> off?</p>
  
  <p>For example, what's the difference between these functions:</p>
  
  <pre><code>int doSomething(int&amp; a, int&amp; b);
  int doSomething(int a, int b);
  </code></pre>
  
  <p>I understand that reference variables are used in order to change a formal->reference, which then allows a two-way exchange of parameters. However, that is the extent of my knowledge, and a more concrete example would be of much help. </p>