What precedence rules apply in parsing this expression:
*(c++);  // c is a pointer.
Thank you.
well, I tried the following
x = *c; c++;
x = (*c++);
x = *(c++);
They appear to be equivalent
What precedence rules apply in parsing this expression:
*(c++);  // c is a pointer.
Thank you.
well, I tried the following
x = *c; c++;
x = (*c++);
x = *(c++);
They appear to be equivalent
There are parentheses grouping the expression, so ++ is evaluated before *.
If the parentheses were removed to obtain *c++, then the expression would still be parsed as *(c++) and not as (*c)++ because of the precedence rules.
The pointer increment is applied first because of the parentheses, then the dereference.
But, the return value of c++ is the value of c before the increment. So the return value of the expression *(c++) is the same as *c. For example:
char *c = "Hello";
char a, b;
a = *c;            // a is 'H'
b = *(c++);        // b is 'H', but now c is "ello"
the ++ operator has not so much to do with precedence, but tells to increment only after evaluation.
So *c will be "returned" and then c will be incremented.
Please don't confuse precedence with order of execution!
As mvds said: the "X++" operator is executed after the evaluation.
From C Language Reference: "When postfix ++ is applied to a modifiable lvalue, the result is the value of the object referred to by the lvalue. After the result is noted, the object is incremented by 1 (one). "