title: Precedence and associativity of prefix and postfix in c
body: <pre class="lang-cpp prettyprint-override"><code>int main()
  {
    char arr[]  = "geeksforgeeks";
    char *ptr  = arr;
  
    while(*ptr != '\0')
        ++*ptr++;
    printf("%s %s", arr, ptr);
  
    getchar();
    return 0;
  }
  </code></pre>
  
  <p>The statement inside while loop <code>++ptr++</code> behaves in a way that I don't understand. The post increment should have been evaluated first because of its high priority and the first output value should have been f(incrementing e). But that does not happen. To understand i changed the statement to <code>++*(ptr++)</code>, so it may give the output what i expect(ffltgpshfflt is the output i expected;but actual output hffltgpshfflt). But still the output does not change. () operator has higher precedence than the pre-increment. But why does not the output change?</p>