C Decision Making


  • Decision Making Statement in C allows user to choose one path from the two or more execution path on the basis of condition. If the condition is true then one set of statement will be executed and if the condition is false another set of statement will be executed.
  • A basic diagram for decision making statement is given below:
Decision making

C includes following decision making statements:

StatementDescription

if statement

An if statement consists of a boolean expression followed by one or more statements.

if...else statement

An if statement can be followed by an optional else statement, which executes when the boolean expression is false.

nested if statements

You can use one if or else if statement inside another if or else if statement(s).

switch statement

A switch statement allows a variable to be tested for equality against a list of values.

nested switch statements

You can use one switch statement inside another switch statement(s).