switch语句的一些规则

来源:互联网 发布:java se6 for mac下载 编辑:程序博客网 时间:2024/05/16 10:46

看contiki源码时,process的断点恢复的地方,有如下例子的用法

#if 1
#include <stdio.h>
#include <assert.h>

int main()
{
int ch;
int whl = 5;
printf("enter:\n");
scanf_s("%d",&ch);


switch(ch)
{
case 0:
printf("case 0\n");
printf("if(1)\n");
if (ch==0)
{
case 1:
printf("{\ncase 1\n}\n\n");
}
while (whl>0)
{
case 2:
printf("whl=%d\n",whl);
whl--;
}
}

system("pause");
return 0;
}
#endif


case2会继续循环


感觉以前太不注意细节了

0 0
原创粉丝点击