int a=4;b=a*a++;b的结果?
单目运算符优先级比双目运算符高,理应是先累加然后相乘得到20,为什么程序运算结果是16?
学习是最好的投资!
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
++a
But there is still a difference between ++a a++
a++ takes the value first and then calculates the increment by 1, ++a takes the value first and then takes the value
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++
a++ takes the value first and then calculates the increment by 1, ++a takes the value first and then takes the value