Watts_an 2015-07-24 03:59 采纳率: 100%
浏览 1645
已采纳

求问读过TCPL的大神,关于C语言switch语句问题

The C Programming Language书中3.4 Switch 开头这么写到:

3.4 Switch
The switch statement is a multi-way decision that tests whether an expression matches one of a number of constant integer values, and branches accordingly.
switch (expression) {
case const-expr: statements
case const-expr: statements
default: statements
}

_Each case is labeled by one or more integer-valued constants or constant expressions. _If a case matches the expression value, execution starts at that case. All case expressions must be different. The case labeled default is executed if none of the other cases are satisfied. A default is optional; if it isn't there and if none of the cases match, no action at all takes place. Cases and the default clause can occur in any order.

我不明白,就粗斜体部分,每一个标签应该只是一个整型常量值或者整型表达式。书上为什么写 one or more,意思是每个case标签也可以是多个整型常量值或整型表达式???

  • 写回答

6条回答 默认 最新

  • threenewbee 2015-07-24 04:44
    关注

    你英文不好,注意是labeled,也就是每个常量用标签标记的,所谓标签,就是一个带有冒号的标注。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序