Conditional Branching Statements
Conditional Branching Statements
o if Statement
o if-else Statement
o nested if-else Statement
o switch Statement
if Statement
This statement is used to execute the specific block of code if a certain condition is
evaluated to be true.
Syntax of if Statement in C
if (condition) {
statement 1….;
else Statement
The else Statement in C is considered just the opposite of the if statement. This statement is
used to execute the code if the condition specified in the if statement evaluates to false.
if (condition) {
// statemnets
} else{
I++ means Use I, then increment it. ++I means Increment I, then use it. I-- means Use I, then
decrement it. --I means Decrement I, then use it.
Jumping statements
In C, jump statements are used to jump from one part of the code to another altering the normal flow of the
program. They are used to transfer the program control to somewhere else in the program.
In this article, we will discuss the jump statements in C and how to use them.
Types of Jump Statements in C
There are 4 types of jump statements in C:
1. break
2. continue
3. goto
4. return
1. break in C
The break statement exits or terminates the loop or switch statement based on a certain condition, without
executing the remaining code.
Syntax of break in C
break;
Flowchart of break Statement
Continue in C
The continue statement in C is used to skip the remaining code after the continue statement within a loop and
jump to the next iteration of the loop. When the continue statement is encountered, the loop control immediately
jumps to the next iteration, by skipping the lines of code written after it within the loop body.
Syntax of continue in C
continue;
Note: Just like break, the continue statement also works for one loop at a time.
Flowchart of continue Statement