我卡在最后一个表达式中,基本运算符:为什么int z = x-- + 2 * x = 25?什么是计算过程?
不应将int z = x-- + 2*x
的计算步骤设置为:int z = (9) + 2(9)= 27
?
但是,当我尝试运行它时,为int z指定的结果是25,为什么?
下面是表达式:
int x = 10;
int y = --x + x;
int z = x-- + 2*x;
,其结果是:
[1] x = 10
[2] x = 9; y = 18
[3] x = 8; z = 25
'X - '是** **后 - 减运算符。所以,'x'的值将首先用于表达式,然后递减。 – Tushar
http://stackoverflow.com/questions/1546981/post-increment-vs-pre-increment-javascript-optimization重复? –