int a=4;
b=a*a++;
b的结果?
单目运算符优先级比双目运算符高,理应是先累加然后相乘得到20,为什么程序运算结果是16?
PHP中文网2017-04-18 10:19:44
int a = 4;
int b = a*++a; // 20
The priority of increment and decrement is indeed higher than *. For example, in the above example, is operated first ++a
But there is still a difference between ++a a++
PHP中文网2017-04-18 10:19:44
a++ takes the value first and then calculates the increment by 1, ++a takes the value first and then takes the value