C conditional statements allow you to make a decision based upon the result of a condition. These statements are called Decision Making Statements or Conditional Statements.
So far, we have seen that all sets of statements in the C program execute sequentially in the same order in which they are written and appeared. This occurs when there are no jump-based statements or repetitions of specific calculations. But some situations may arise where we may have to change the order of execution of the statements depending on some particular conditions. This involves a kind of decision-making from a set of calculations. It is to be noted that the C language assumes any non-zero or non-null value as
true, and if zero or
null, treated as
This type of structure requires that the programmers indicate several conditions for evaluation within a program. The statements will be executed if the condition becomes
true, and optionally, if the condition becomes
false, an alternative statement or set of statements will be executed.
The flowchart of the Decision-making technique in C can be expressed as:
C languages can make such decisions within their program by following decision-making statements: