C language flow

Xx_a Introduction

C language flow,control program order.

Xx_b Foundation

  • satement:foundamental.and after addtion(😉
  • program block:multiply statement.use brace include({})

Branch

Ax_x if-else and else-if

Ax_a if-else

if(expression)
{
    statement;
}
else
{
    statement;
}

Ax_b else-if

if(expression)
{
    statement;
}
else if
{
    statement;
}
else if
{
    statement;
}
else
{
    statement;
}

! last else 

Ax_c if nest

if(expression)
{
    if(expression)
    {
        statement;
    }
    if(expression)
    {
        if(expression)
        {
            statement;
        }
        else if(expression)
        {
            statement;
        }
    }
    
}

Bx_x Switch

switch(expression)
{
    case contant-expression:
        statement;
        break;
    .
    .
    case contant-expression:
    case contant-expression:
        statement;
        break;
    .
    .
    default:
        statement;
}

Bx_a switch nest

switch(expression)
{
    case content-expression:
        statement;
        switch(expression)
        {
            case content-expression:
                statement;
                break;
            case content-expression:
                statement;
        }
        break;
    case content-expression:
        statement;
        break;
    default:
        satement;
}

Cx_a ?:

expression1 ? expression2 : expression3

Circulate