0
about test questions
…… int x=8; int y=7; x++; x+=y--; why the value of final x is16 not 9+6=15 Can anyone show me the calculating process,thanks.
1 Resposta
+ 6
Because y will only be decremented after the assignment. x = y-- means: assign the value of y to x and decrement y afterwards. x = --y means: decrement y first and then assign the new value to x. So you would be correct if the code said x += --y.