题目:设int a; 则表达式(a=2,3),a+1的值
#include<stdio.h>
int main(void)
{int a=0;int b;int c;b = (a=2,4);c = (a=2,3),a+1;printf("a+1=%d\n",a+1); //a+1 = 3;printf("a=2,4的值为:%d\n",b); //a=2,4的值为:4printf("(a=2,3),a+1的值为:%d\n",c); //(a=2,3),a+1的值为:3return 0;
}
- 逗号运算符的优先级最低
- 运算规则:依次计算左边、右边的表达式;结果是最后一个逗号右边表达式的结果