title: C++ Reference Variables (reference variables, pointer variables)
body: <p>Can someone please explain why we get the output we see in the following source code?</p>
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt; 
  
  int main()   {  
     int x{ 10 };
     int &amp;rx{ x };
     rx = 123; 
     std::cout &lt;&lt; x &lt;&lt; &quot; &quot; &lt;&lt; rx &lt;&lt; std::endl;  
  }
  </code></pre>
  <p><strong>Output</strong></p>
  <pre class="lang-none prettyprint-override"><code>123 123 
  </code></pre>
  <p>Why is the output <code>123 123</code> and not <code>10 123</code>?</p>
  <p>Also: what is the difference between <code>int x {10};</code> vs <code>int x = 10;</code>?</p>