title: Confusion over pointer index operator
body: <p>I am a little bit confused about pointer index operator in C. I will try to explain my question with an example:</p>
  <pre><code>int array[5] = {1,2,3,4,5};
  int *p;
  p = array;
  p[2]++;
  </code></pre>
  <p>In the fourth line, I know that it increments the second index of array. However, when I see an index operator, I convert it.</p>
  <p>For instance, I converted <code>p[2]++</code> to <code>*(p+2)++</code>. According to the <a href="https://en.cppreference.com/w/c/language/operator_precedence" rel="nofollow noreferrer">operator precedence table</a>, in the statement of <code>*(p+2)++</code>, the increment and dereferencing operators have the same precedence, but increment takes precedence due to right associativity. Therefore, it becomes <code>*(p+3)</code>. Then, this statement cannot change any value and just points third index of  array.</p>
  <p>Why does <code>p[2]++</code> increment the second index of the array? What is wrong in my perspective?</p>