Definition
Decision-Making Statements in C Programming Language allows you to make the decision based on specific condition to determine the order in which statement has to be executed, or repeat a group of statements till particular conditions are met.
Understanding
When working, there are several instances when we have had to make decisions. Similarly, when writing a program code, one may come to point when a decision has to be made.
C allows decisions to be made by evaluating a given expression as true or false. Such an expression involves the use of logical and relational operators. Depending on the outcome, program execution accordingly branches out.
Basicaly there are three types of decision making statements in C.
Simple if statement is used to execute or skip on one statement or set of statements for a particular condition.
x is greater than y
If the condition within the parantheses evaluates to true, then, the statement immediately following it is executed; otherwise the statement following the else clause is executed. Given below is a syntax and flowchart depiction of the if-else statement.
y is greater than x
A nested if is an if statement that is the target of another if or else. Nested ifs are very common in programming.
When you use nested if, the main thing to remember is that an else statement always refers to the nearest if statement that is within the same block as the else and that is not already associated with an else.
i is smaller than 15 i is smaller than 12 too