title: What's the point of const pointers?
body: <p>I'm not talking about pointers to const values, but const pointers themselves.</p>
  
  <p>I'm learning C and C++ beyond the very basic stuff and just until today I realized that pointers are passed by value to functions, which makes sense. 
  This means that inside a function I can make the copied pointer point to some other value without affecting the original pointer from the caller.</p>
  
  <p>So what's the point of having a function header that says:</p>
  
  <pre><code>void foo(int* const ptr);
  </code></pre>
  
  <p>Inside such a function you cannot make ptr point to something else because it's const and you don't want it to be modified, but a function like this:</p>
  
  <pre><code>void foo(int* ptr);
  </code></pre>
  
  <p>Does the work just as well! because the pointer is copied anyways and the pointer in the caller is not affected even if you modify the copy. So what's the advantage of const?</p>