ITPub博客

首页 > 应用开发 > > c语言中switch在这个代码中咋执行的

c语言中switch在这个代码中咋执行的

作者:BonardGalton 时间:2019-08-12 11:46:21 0 删除 编辑

int i = 0;

while (i < 3)

{

switch (i++)

{

case 0: printf("fat ");

case 1: printf("hat ");

case 2: printf("cat ");

default:printf("Oh no!");

}

putchar('\n');

}

不应该先是i=0,然后0<3, 0+1=1, 执行case1以及以后的语句嘛

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4295/viewspace-3153775/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2019-08-12

  • 博文量
    89
  • 访问量
    1135