Hi All,
I observed something surprising:
Here is code snippet
*****************
int i = 5;
i = i++ + ((((8 << 1) << (5 << 1)) * 3 * 3)) + ++i;
printf ( "i = %d \n " ,i);
*****************
output
i = 147469
But if i just assign the middle expression i.e. ((((8 << 1) << (5 <<
1)) * 3 * 3)) to an integer k my output changes
**************
int i = 5;
int k = 0;
k = ((((8 << 1) << (5 << 1)) * 3 * 3));
i = i++ + k + ++i;
printf ( "i = %d \n " ,i);
***************
output
i = 147468
As far as i know postfix increment should evaluate only at the end of
expression as in case 2 . but in case 1 it is getting incremented
during evaluation .
I am not able to figure out why i am getting this difference in
output.
Thanks in advance
Sarab