How to analyse the precedence in following situation .
for (i=0; i<20; i++)
{
*array_p++ = i*i;
printf(\"%d\\n\",*arr++);
}
how
Postfix operators have higher precedence than unary operators, so *x++
is parsed as *(x++)
; the result of the expression x++
(which is x
) is dereferenced.
In the case of *++x
, both *
and ++
are unary operators and thus have the same precedence, so the operators are applied left-to-right, or *(++x)
; the result of the expression ++x
(which is x + sizeof *x
) is dereferenced.