title: Dereferencing through pointer and incrementing gives a different value and decrements it instead C++
body: <p>I was trying to do some experiments with pointers in C++, I did understand the concepts of precedence a bit but the following program is mingling with my mind and am unable to comprehend it</p>
  <p>CODE:</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main() {
  
      int x = 9;  
      int* ptr = &amp;x;
  
  cout &lt;&lt; &quot;The value of x is &quot; &lt;&lt; x &lt;&lt; endl &lt;&lt; &quot;The value of ptr is &quot; &lt;&lt; ptr &lt;&lt; endl &lt;&lt; *ptr &lt;&lt; endl &lt;&lt; (*ptr)++ &lt;&lt; endl &lt;&lt; (*ptr)++ &lt;&lt; endl &lt;&lt; (*ptr)++ &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  <p>in this program gave the initial value to x as 9 and i expect the compiler to give me value of x as 9 and then increment it using pointers so i expected the answer to be as 9,Address,9 ,10,11,12 but instead the answer i get in every compiler is that the value of x is 12 and rest is like this 12,Address,11,10,9
  Please help me understand this am a newbie in C++</p>