您的位置:首页 > 其它

switch语句的一些规则

2015-10-06 10:05 246 查看
看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会继续循环

感觉以前太不注意细节了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  switch