C語言迷惑行為大賞[switch中case項目設定區間]

C語言迷惑行為大賞[switch中case項目設定區間]

C語言迷惑行為大賞[switch中case項目設定區間]


資料來源: https://mp.weixin.qq.com/s?__biz=MzA3MTU1MzMzNQ==&mid=2247485555&idx=1&sn=e222ca6064ed3a000039099c478b8c67&chksm=9f2a902ba85d193d1717865daf0b014720fba0d568d733427e82de2d60aff9ebdd822c0353c4&scene=126&sessionid=1594351540&key=e6152aaf211ea82428512ba6cda10fb57203bacbf7272a94179f45e3167e92603758bd892781565be02c628ae1c5e381fd40d0234c9489bc9293c4e883ea5053773d8a3c65d06d6227d5ace154b790de&ascene=1&uin=MjIwODk2NDgxNw%3D%3D&devicetype=Windows+10+x64&version=62090529&lang=zh_TW&exportkey=Av1ixewtT0Lg9Az0ImJXXRo%3D&pass_ticket=3bOdmPRA9vPTpFTGflvy6jtjNpb4Y8z%2BW9NnDBSe36ijgCfp7yHzgYsIfoABWl9t


線上執行: https://www.tutorialspoint.com/compile_c_online.php

#include<stdio.h>
int main(void)
{
    int c = 5;
    switch(c)
    {
        case 0 ... 10:
            printf("0-->10\n");
            break;
        case 11 ... 20:
            printf("11-->20\n");
            break;
        default:
            printf("other\n");
    }
    return 0;
} 

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *