嵌套三目运算符

单选题 难度 3

#branch#operator

三目运算符是右结合的。

题目

当 a = 7 时,表达式 (a > 10 ? 1 : a > 5 ? 2 : 3) 的值是( )。
  1. 2
  2. 1
  3. 3
  4. 无法确定
来小码星球,动手写一遍 →