for Loop in C
The for loop in C language is also used to iterate the
statement or a part of the program several times, like while and
Unlike do while loop, the condition or expression in for loop
is given before the statement, so it may execute the statement 0 or
Syntax for Loop in C
//code to be executed
For loop contains tree parts
- When we are working with for loop always execution process
will start from initialization block.
- After initialization block control will pass to condition
block, if condition is evaluated as true then control will pass to
- After execution of the statement block control will pass
to iteration block, from iteration it will pass back to the
- Always repetitions will happen beginning condition,
statement block and iteration only.
- Initialization block will be executed only once when we
are entering into the loop first time.
- When we are working with for loop everything is optional
but mandatory to place 2 semicolons (; ;)
Example of for loop in C