Pre and Post Increment/Decrement Operator

shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Can anyone explain the output of the following program

Code:
int main()
{

  int i=1;
  i = i++ + ++i + ++i + i++ + ++i;
  printf("%d\n",i);

  i=1;
  i = i-- - --i - --i - i-- - --i;
  printf("%d\n",i);
  return 0;
}
Output
16
2

Thanks
Shabbir Bhimani
coderzone's Avatar, Join Date: Jul 2004
Team Leader
I could never get past this operators.