How if-else Statement works?
Working of the if-else statement in C is explained below:
- When the program control first comes to the if-else block, the test condition is checked.
- If the test condition is true:
- The if block is executed.
- If the test condition is false:
- The else block is executed
- After that, the program control continues to the statements below the if-else statement.
We can understand the working of the if-else statement in C with the help of the flowchart.
C if…else Statement
The if-else statement in C is a flow control statement used for decision-making in the C program. It is one of the core concepts of C programming. It is an extension of the if in C that includes an else block along with the already existing if block.