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
  • 52,963
  • 14
  • 96
  • 130
Harsh Yadav
  • 166
  • 10
  • 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