1
int i=3;

int k=i++ + ++i;

int j=i++ + ++i + ++i + i++ + i++;  /*is this statement compiler dependent?*/

printf("K=%d j=%d",k,j);

and second one is

j=-i++;

In this expression which operation is performed first; both are right to left associative and having same precedence. Actually I want to know the concept of Associativity and Precedence in context of Unary operator using this example.

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Harsh Yadav
  • 168
  • 12
  • http://stackoverflow.com/questions/4638364/undefined-behavior-and-sequence-points-reloaded – Charles Salvia Jun 21 '13 at 15:35
  • The second part: postfix operators bind more tightly than prefix. Note that if you write `(-i)++`, that doesn't even compile, because `-i` is an rvalue and you can't apply increment to that. – Sebastian Redl Jun 21 '13 at 15:58

0 Answers0