title: declaration of reference and pointer in c++
body: <p>For example, if F is a reference to an integer, where the reference is not permitted to be pointed to a new object once it is initially pointed to one.</p>
  
  <p>Can I write to declaration like: const int &amp; F?</p>
  
  <p>I am confused about reference and pointer, because they both represent the address of something, but we always write parameter use reference as: const &amp; F, I understand that this is to reduce the copy and does not allow others to change it, but are there any other meanings? and why do we need "const" after a function declaration like: int F(int z) const; this const makes the return type const or everything in the function const?</p>
  
  <p>One more example,</p>
  
  <pre><code>void F(int* p)
  {
  p+=3;
  }
  
  int z=8;
  F(&amp;z);
  std::cout&lt;&lt;z&lt;&lt;std::endl;
  </code></pre>
  
  <p>What is the output for z since z is a reference, and I pass it as a pointer who points to an integer.Increasing p by 3 just makes the address different and does not change its value?</p>