how does this work
but out put is i =3 and j =4;Code:main()
{
int i=3;
int j;
j = sizeof(++i+ ++i); // ++i = 4, again ++i = 5. Then ++i + ++i = 5+5 = 10?
printf("i=%d j=%d", i ,j);
}
Printable View
how does this work
but out put is i =3 and j =4;Code:main()
{
int i=3;
int j;
j = sizeof(++i+ ++i); // ++i = 4, again ++i = 5. Then ++i + ++i = 5+5 = 10?
printf("i=%d j=%d", i ,j);
}
Okay, I was about to quote concerning evaluation order, but in this case it does not matter.
The answer is that sizeof does not evaluate its operand, so what you are seeing is equivalent to sizeof(int), which in this case is 4.
i think that the pre increment or post does not vary w.r.t to i and the j depends on size of operator