作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
CASE expr_no_commas ELLIPSIS expr_no_commas ':'
我在c的语法规则中看到了这样一条规则,但是当我尝试重现它时:
int test(float i)
{
switch(i)
{
case 1.3:
printf("hi");
}
}
它失败了......
最佳答案
好吧,这涉及到我的一些猜测,但看起来你在谈论一个 gcc
C 的扩展,允许在 switch
中指定范围例。
以下为我编译:
int test(int i)
{
switch(i)
{
case 1 ... 3:
printf("hi");
}
}
注意 ...
还要注意你不能打开 float
.
关于c - 如何在c的case语句中使用省略号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5327896/
我是一名优秀的程序员,十分优秀!