c语言中算术运算优先级高于移位运算

#include <stdio.h>

int main(void){
        int a = 1;
        int b = a<<1+2;
        printf("%d\n",b);
        return 0;
}

上面的这段代码,结果是8,而不是4,因为算术运算优先级高于移位运算。

posted @ 2013-04-02 22:17  坚固66  阅读(173)  评论(0编辑  收藏  举报