c语言自加符号第7题应该是按什么顺序算?

2025-05-01 05:03:17
推荐回答(2个)
回答1:

C)正确,2。因为问的是表达式“a++

//#include "stdafx.h"//If the vc++6.0, with this line.
#include "stdio.h"
int main(void){
    int a=1,b=2,c=3,d=4;
    printf("%d\n",a++    return 0;
}

输出是2。所以答案给出的分析是张冠李戴,胡搅蛮緾……

运算顺序是——因为a++

回答2:

选c=2
优先级,从右边往左边依次算出