Decision making statements in C will let you to execute specific blocks of statements under specified conditions. The decision making statements will check for the given condition and if it meets specified condition then it will allow execution of statements.

decision-making-in-C

C languages has provided numerous method for making decisions in programs:

Following are the available statements for decision making in C language:

  1. if statement

    If statement consists of only true block. You can execute number of statements if the condition is true.

    For more about if statement visit my article on If statement in C

  2. if … else statement

    If else statement consists of two blocks true and false block. When the given condition is true the true block is executed and if the condition is false then the false block is executed.

    For more about if … else statement visit my article on If … else statement in C.

  3. if … else if … else statement

    If … else if … else statement is an extended form of if … else statement. It provides number of optional blocks for the different conditions.

    For more about if … else if … else statement visit my article on If … else if … else statement in C.

  4. nested if statement

    Nested if statement is same as if statement in addition in this statement we can write number of if statements within if statement.

    For more about nested if statement visit my article on Nested if statement in C.

  5. switch case statement

    Switch case statement consists of number of cases which upon condition match execute the statements.

    For more about switch case statement visit my article on Switch case statement in C.

  6. conditional statement

    A conditional statement is a ternary operator. It has three blocks the condition block, the true block and the false block.

    For more about conditional statement visit my article on Conditional statement in C.