0

Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)

I've read about these sort of statements before, but this one is strange.

For this piece of code in C,

int main()
{
  int a=5,i;
  i = (++a)+(++a)+(++a);
  printf("%d",i);
  return 0;
}

what output should one expect ? Or does it result in undefined behaviour ?

Community
  • 1
  • 1
Cygnus
  • 3,170
  • 9
  • 35
  • 62

0 Answers0