递增递减运算符的优先级。
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int x=2;
printf("%d",x*x++);
return 0;
}
捕获.PNG
递增运算符和递减运算符都有很高的结合优先级,只有圆括号的优先级比他们高。
因此
XX++
等价于x(x++)
x++=2;x=3
3*2=6