title: Incrementing pointer (ptr++) and (*ptr++)
body: <p>I was revisiting pointers when I had this doubt.</p>
  
  <pre><code>int *ptr;
  int arr[5] = {10,20,30,40,50};
  ptr = &amp;arr[0];
  </code></pre>
  
  <p>Now <code>printf("Value: %d",*ptr);</code> would print <code>10</code></p>
  
  <p>if I do:</p>
  
  <pre><code>ptr++;
  printf("Value: %d",*ptr);
  </code></pre>
  
  <p>the result would be: <code>20</code></p>
  
  <p>Similarly if I do:</p>
  
  <pre><code>*ptr++;
  printf("Value: %d",*ptr);
  </code></pre>
  
  <p>the result is: <code>30</code></p>
  
  <p>But</p>
  
  <pre><code>printf("Value: %d",++*ptr);
  </code></pre>
  
  <p>gives me <code>31</code></p>
  
  <p>I thought since <code>ptr</code> is of type <code>int</code> when I increment it, it would jump 4 bytes to the next memory location. But why does it show the same behavior for <code>*ptr++</code> and <code>ptr++</code> and not for <code>++*ptr</code>?</p>