3.7.3. 条件范围

可以在 switch 语句中指定值范围。

示例


int Case_Ranges_0(int arg)

{

    int aLocal;

    int bLocal =arg;

    switch (bLocal)

    {

        case 0 ... 10:

            aLocal= 1;

            break;

        case 11 ... 100:

            aLocal =2;

            break;

        default:

            aLocal=-1;

    }

    return aLocal;

}

Copyright © 2007 ARM Limited. All rights reserved. ARM DUI 0348AC
Non-Confidential