If you go through precedence table, then post increment/decrement has higher precedence than pre increment/decrement.
Bonus Article : - Why Post increment is higher precedence than pre increment [ http://bit.ly/2dLll0F ]
Precedence 2 - post increment/decrement and Associativity - Left to Right
Precedence 3 - pre increment/decrement and Associativity - Right to left
- has same precedence with pre increment/decrement, and associativity is Right to left.
Expression 1:
++*p - Here as pre increment and * is there and both has same priority so it executed as Right to left : so first *p and then ++
So according to ur question *p = 1, ++(*p) so which expands to *p = (*p) + 1, so *p becomes 2, arr[0] becomes 2;
Expression 2:
*++p - Here as pre increment and * is there and both has same priority so it executed as Right to left : so first ++p and then *
So according to ur question ++p ( p = p + (1* size of (type of data it is pointing) here int), now p is pointing to the next element of the array. so *p prints the value of next element of array which is 2;
Expression 3:
*p++ - Here as post increment is higher precedence than * so p++ ( p = p + (1* size of (type of data it is pointing) here int)) and then *[new value of p] , P++ pointing to the next element of the array so pointing to 2, *p prints 2.
Hope it is clear