title: Can we reassign the reference in C++?
body: <p>I have read everywhere that a reference has to be initialized then and there and can't be re-initialized again.</p>
  
  <p>To test my understanding, I have written the following small program. It seems as if I have actually succeeded in reassigning a reference. Can someone explain to me what is actually going on in my program?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  
  using namespace std;
  
  int main()
  {
      int i = 5, j = 9;
  
      int &amp;ri = i;
      cout &lt;&lt; " ri is : " &lt;&lt; ri  &lt;&lt;"\n";
  
      i = 10;
      cout &lt;&lt; " ri is : " &lt;&lt; ri  &lt;&lt; "\n";
  
      ri = j; // &gt;&gt;&gt; Is this not reassigning the reference? &lt;&lt;&lt;
      cout &lt;&lt; " ri is : " &lt;&lt; ri  &lt;&lt;"\n";
  
      getch();
      return 0;
  }
  </code></pre>
  
  <p>The code compiles fine and the output is as I expect:</p>
  
  <pre class="lang-none prettyprint-override"><code>ri is : 5
  ri is : 10
  ri is : 9
  </code></pre>