我新手,c语言关系运算符和赋值运算符,哪个优先级高?比如a=b>c怎么理解?

如题所述

下面的是优先级排序上面的高下面的低,左右高低有描述。
() [] -> . left to right
! ~ ++ -- + - * (type) sizeof right to left
* / % left to right
+ - left to right
<< >> left to right
< <= > >= left to right
== != left to right & left to right
^ left to right
| left to right
&& left to right
|| left to right
?: right to left
= += -= *= /= %= &= ^= |= <<= >>= right to left
, left to right
========================
a=b>c 相当于 a = (b> c)
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-12-23
a的值就是后面两个数比较出来的逻辑值
例如:1 b=3, c=6则:
b>c不成立
所以a=0
2 b=6, c=2则:
b>c成立
所以a=1
第2个回答  2010-12-23
我觉得是j++,"="当然是运算符了,赋值语句是指有+=,=,-=,*=,/=的语句,j++虽有赋值效果,但本身不符合赋值语句的语法。
三目高于赋值的,所以那句话还是对的。
第3个回答  2010-12-24
是的,先转换,再运算。
第4个回答  2010-12-23
a=(b>c)
肯定是关系运算先计算的...
第5个回答  2010-12-23
相当于 a = (b>c)。把b>c的值赋给a.
参看:http://www.slyar.com/blog/c-operator-priority.html
相似回答