For loop stars with "for" keyword and three parameters enclosed within a first bracket. Three parameters are -
- Initialization statements
- Condition of the looping
- Repeat steps
For loop stars with "for" keyword and three parameters enclosed within a first bracket. Three parameters are -
While loop stars with "while" keyword and is one condition for the loop which is enclosed within a first bracket. Loop statements are enclosed with a second bracket. This bracket in not needed if there is only one statement.
Do While loop stars with no condition and loop statements are enclosed with second bracket. However "while" keyword along with the condition is placed at the end of the loop statement. Thus entry to the loop is unconditional but the exit or the continuation is decided by the condition expression.
Initial statement(s) - these are one or multiple statements (use comma in between). Often contains initialization of counter variables.
Repeat step(s) - these are one or multiple statements. Often contains counter operation on variables like increment, decrement etc.
Condition statement - is however only one condition statement.
Condition statement - for loop will be an infinite if it is blank.
Condition expression - while/do-while loop will be an infinite if it is a always TRUE.
Loop statement(s) - these statements are tasks in each steps. Counter variables are often used in the steps.
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.