Conditional statements are often called decision-making statements. Conditional statements in C are used to execute different sections of code based on particular conditions. These conditions are provided by a series of decision-making statements with Boolean expressions. Boolean expressions are evaluated as true or false.
An if statement contains a Boolean expression that is evaluated to a Boolean value. If the value is True, the block executes; otherwise, the next statement is executed.
An if-else statement consists of two statements: the if statement and the else statement. When an expression in an if-statement is evaluated as true, the if block is executed; otherwise, the else block is run.
It makes use of several if-else if-else statements to test a set of conditions. The statement that meets the outcome will be performed. If no condition matches the result, the default else statement will be executed.
A switch statement tests a set of conditions using one or more cases that are compared to the switch expression. The case that meets the requirements would be executed. When no cases match the result, the default case is executed.