title: Why does this program show 3 outputs, also why does b override a?
body: <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  void silly(int &amp; a, int &amp; b)
  {
      a=10;
      b=20;
      cout &lt;&lt; a &lt;&lt; "" &lt;&lt; b &lt;&lt; endl;
  }
  
  
  void main()
  {
      int z=30;
      silly(z,z);
      cout &lt;&lt; z &lt;&lt; endl;
      system("Pause");
  
  }
  </code></pre>
  
  <p>The output for this is:</p>
  
  <p>2020
  20</p>
  
  <p>Why are there 3 outputs, and why does b override a?</p>
  
  <p>I'm asking because this is part of homework and I don't exactly understand the passing of variables especially strings/arrays.</p>