title: Can somebody explain to me what is "reference reseating", and why is it not possible for "a reference to point(refer) to another object"?
body: <p>According to these links: <a href="https://stackoverflow.com/questions/17898110/what-does-reference-can-never-be-made-to-refer-to-another-object-mean">stackoverflow question</a> and <a href="http://yosefk.com/c++fqa/ref.html#fqa-8.5" rel="nofollow noreferrer">C++ FQA</a> references cannot refer to another object/ variable well once they're initialized, but what about the below code? </p>
  
  <pre><code>// Example program in C++
  #include &lt;iostream&gt;
  using namespace std;
  int main()
  {
      int x=10, z=12;
      int &amp;y=x;
      ++y;
      y=z; //valid?
      cout &lt;&lt; x &lt;&lt; ", "&lt;&lt; y &lt;&lt;", " &lt;&lt; z &lt;&lt; endl; // prints 12, 12, 12
      return 0;
  }
  </code></pre>
  
  <p>Below is the C code regarding pointer reseating and it seems valid, am I right?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(int argc, char *argv[])
  {
      int a=10, b=20;
      int *ptr;   
      ptr = &amp;a;
      ptr = &amp;b;
      printf("%d\n",a); // prints 10
      printf("%d\n",*ptr); // prints 20
      return 0;
  }
  </code></pre>
  
  <p>Can someone clear the above concept in the above two codes?</p>