GCC:

error: a label can only be part of a statement and a declaration is not a statement

switch(a){        swtch(a){

case 1:         case 1:

....................       {

....................        ...............

....................        ...............

break;          ................

case 2:         }

break;          break;

}            case 2:

             break;

            }

Error         OK

case1:
//此块代码不能再声明变量,如果你声明变量就会报错,除非用括号括起来,这是编译器的问题,也可以说是C语言的规定。写代码的时候注意就成了。就像C语言再声明的时候不能赋值一样,记住就好了。
break;
希望对你有所帮助。

error: a label can only be part of a statement and a declaration is not a statement相关推荐

  1. a label can only be part of a statement and a declaration is not a statement

    今天在查阅u-boot代码时,发现一个奇怪的地方.记录下来,以备后续追溯. u-boot代码的main.c模块中,有一个cread_line函数,其中有一段话是这样的: case '\t':int n ...

  2. 错误“a label can only be part of a statement and a declaration is not a statement”解决方法

    之前写代码的时候用了一个goto语句,结果编译提示a label can only be part of a statement and a declaration is not a statemen ...

  3. C语言常见问题(11):a label can only be part of a statement and a declaration is not a statement

    a label can only be part of a statement and a declaration is not a statement [ 标签只能是语句的一部分,而声明不是语句] ...

  4. C语言报错:a label can only be part of a statement and a declaration is not a statement

    在写代码的时候,变量的声明不应该出现在label之后 比如switch语句中的case结构也可能会遇到类似的问题. 在case标签下面定义了变量,则会报错. 对此问题的分析: 由于switch的几个c ...

  5. MIT6.S081 2021

    MIT6.S081 2021 环境配置 Xv6 and Unix utilities vscode格式化头文件排序问题 以地址空间的视角看待变量 其他 代码参考 system calls trace ...

  6. CodeBlocks常见编译错误(to be updated)

    第一要则,不要直接点击"编译并且运行",而是应该点击"编译(build)"按钮,这样可以保证警告不会被忽略,一些警告是非常有用的. 第二要则:有多个错误,要先处 ...

  7. 设置同一Label内涵不同颜色字体

    UILabel * label = [[UILabel alloc]init]; NSString * htmlString = @"<span style=\"font-f ...

  8. Python GUI设计——Label标签

    目录 1.常用参数 2.共同属性 2.1Color 2.2Dimensions 2.3Anchor 2.4Wraplength 2.5Font 2.6Justify 2.7Bitmaps 2.8Com ...

  9. ZFS - vdev label 的加载与同步

    前一篇文章中我们说明了ZFS的Label在磁盘上的存储形式,这篇文章中,我们将详细说明一下Vdev在内存中的组织形式以及相关的实现细节. 1. vdev label的内存结构 上一篇中我们介绍过,vd ...

最新文章

  1. 并发编程-21J.U.C组件拓展之Future和FutureTask
  2. 斜面孔如何绘制_journal of neuroscience:面孔的神经表征与眼动模式相协调
  3. 每日英语:Apple Unveils New iPads
  4. 在Linux上使用的10种云备份方案
  5. django获取字段列表(values/values_list/flat)
  6. 在线网页快捷方式创建工具
  7. LeetCode之猜数字大小
  8. Android反编译:使用dex2jar查看dex文件
  9. [POI2013]LUK-Triumphal arch
  10. C#-实现的鼠标钩子
  11. linux 清除dns缓存
  12. Z字型变幻,整数反转
  13. 文件“无法删除”的处理方法
  14. Android x86 4.4-r1 PC正式版发布
  15. 大一新生必会的c语言五子棋!PVP,PVE,EVE模式都有,还有智能的AI部分,复盘等内容!一看就会的五子棋教程,确定不来看看吗?
  16. 公司常用软件测试工具梳理
  17. 2020 中科院 CVPR : Context-Aware Attention Network for Image-Text Retrieval
  18. 如何激活win10家庭版?这个方法超管用
  19. ABAQUS切削模拟
  20. 全球及中国AV瘘针组行业需求趋势及投资前景预测报告(新版)2022-2027

热门文章

  1. Repeater控件使用总结
  2. 【转】子网划分实例与讲解
  3. 一个按钮触发两个事件可以吗?
  4. 2018-2019-1 20165324_20165302_20165321 实验一 开发环境的熟悉
  5. 7.SpringMVC 配置式开发-ModelAndView和视图解析器
  6. 《解释的工具:生活中的经济学原理 读书笔记6》
  7. oracle中的not in和not exists注意事项
  8. HttpClient接口Post方式
  9. Quick Cocos2dx 调试问题
  10. ISA Server出现12250错误的解决方法