0
Help! How this results 5
x=1; x++ + x++ * --x=5 How???
4 Respuestas
+ 1
1+2*2
The first x is 1, the second x is 2, the third x is 3-1, i.e. 2
+ 4
The first x uses the value 1, but adds 1 for the next value. The second x thus equals 2 and adds 1 for the third x. The third x is 3-1, i.e. 2
+ 1
Why is the first x 1 and second x 2?
Mikhail Gorchanyuk
AFAIK x++ first uses the x value and than increments
--x decrement first and then increments so shouldn't it be 1st x 1, 2nd x 1 and third x 0?
+ 1
So each time x "appears" in code it gets incremented by 1?
I thought each end of statement (;) increments it