title: Constant pointer variables in C++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1143262">What is the difference between const int*, const int * const, and int const *?</a></p>
  </blockquote>
  
  
  
  <p>I know two variations of pointer variables in <a href="http://en.wikipedia.org/wiki/C%2B%2B" rel="nofollow noreferrer">C++</a>.</p>
  
  <p>Say I have </p>
  
  <pre><code>mystruct{
      int num;
  }
  </code></pre>
  
  <p>Variation 1:</p>
  
  <p><code>const mystruct* m1;</code> means the member variables in m1 can not be altered, for instance, <code>m1-&gt;num = 2</code> would produce an error.</p>
  
  <p>Variation 2:</p>
  
  <p><code>mystruct *const m2 = m1;</code> means once m2 is set to point to m1, an error would be produced if you subsequently set <code>m2 =m3</code>.</p>
  
  <p>However, there seems to be a third variation, that I am not certain the property of:</p>
  
  <p>Variation 3:</p>
  
  <pre><code>mystruct const * m3;
  </code></pre>
  
  <p>What does this mean?</p>