小话C语言中的cotinue和break

来源:互联网 发布:网络延长器怎么用图解 编辑:程序博客网 时间:2024/06/06 12:25
#include<stdio.h>int fun(){    printf("fun\n");    return 1;}int main(int argc,char *argv[]){    int c=0;    printf("please input your num ,case 3 to break\n");    do{         scanf("%d",&c);        switch(c){            case 0:                break;  /*这里的break只会跳出swtich*/            case 1:                continue;  /*直接跳到while处判断*/            case 3:                printf("in case 3 going to break\n");                break;            default:                break;        }        printf("inside while ,keep going!\n");    }while(fun());    printf("out of while finish\n");    return(0);}

编译运行

gcc -o break break.c

./break

please input your num ,case 3 to brea

k(输入)1fun

(输入)2inside while ,keep going!fun

(输入)3

in case 3 going to breakinside while ,keep going!

fun

原创粉丝点击