title: Pointer Problems : Assigning to 'int *' from incompatible type 'int
body: <p>I've been reading the book "Jumping into C++", and am currently reading up on pointers. This is an exercise from the book: </p>
  
  <p>"What are the final values in <strong><code>x</code></strong>, <strong><code>p_int</code></strong>, and <strong><code>p_p_int</code></strong> in the following code:</p>
  
  <pre><code>int x = 0;
  int *p_int = &amp; x;
  int **p_p_int = &amp; p_int;
  *p_int = 12;
  **p_p_int = 25;
  p_int = 12;
  *p_p_int = 3;
  p_p_int = 27;
  </code></pre>
  
  <p>And I get the error:</p>
  
  <blockquote>
    <p>"Assigning to <code>int *</code> from incompatible type <code>int</code>" </p>
  </blockquote>
  
  <p>On the last three lines.</p>
  
  <p>I don't know why this is happening, and would appreciate any insight. </p>
  
  <p>Furthermore, assuming that this code somehow works, I would think that since all pointers are just pointing towards a single memory (<strong><code>**p_p_int -&gt; *p_int -&gt; x</code></strong>), the last value assignment would dictate the final value of the memory location. However in the book, the answer is:</p>
  
  <blockquote>
    <p><strong><code>x = 25, p_p_int = 27, p_int = 3</code></strong></p>
  </blockquote>
  
  <p>Is this correct? If so, could anyone explain this to me?</p>