int a=4;
b=a*a++;
b的結(jié)果?
單目運算符優(yōu)先級比雙目運算符高,理應(yīng)是先累加然后相乘得到20,為什么程序運算結(jié)果是16?
學(xué)習(xí)是最好的投資!
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++
a++ takes the value first and then calculates the increment by 1, ++a takes the value first and then takes the value