Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Pre and Post Increment/Decrement Operator (http://www.go4expert.com/forums/pre-post-increment-decrement-operator-t389/)

shabbir 19Jul2005 17:24

Pre and Post Increment/Decrement Operator
 
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 19Jul2005 17:27

Re: Pre and Post Increment/Decrement Operator
 
I could never get past this operators.


All times are GMT +5.5. The time now is 08:55.