Initially, when you do char *p=arr; it means p=&arr, i.e. p is pointer to first character in the char array arr.
When you do ++*p;
Unary ++ and Pointer (*) operators have same precedence and both are right to left associative, so this statement is equivalent to:
Which is same as:
Hence, arr will now become ’g’+1 i.e. ’h’
Then you print *p which is same as arr, Hence the output will be h.
In the statement *p++; postfix operator ++ has higher precedence (moreover, postfix operators have highest precedence among all operators), so this statement will be equivalent to:
//this statement evaluates to arr, if you would have assigned *p++, to any character, then it would have become arr, i.e. ‘g’
For the given program, the only useful operation that will affect the output is p++, because you are printing the value of *p after this operation. So, new value of p will be p+1, since p was the address of arr, p+1 will be the address of arr, hence, now p points to arr, hence, when you print *p, the output will be arr, i.e. character e will be printed.