-Any code that are written inside the loop are run continously until the loop condition is become.
Structure of loop in C:
Basically, any loop are contain 3 basic things:
1.initialization
2.condition
3.increament/decreament
Types of Loop in C:
1. for loop
2. while loop
3. do while loop
1. for loop:
Syntax-
for(initialization,condition,++/--)
{
body;
}
2. while loop:
Syntax-
initialization;
while(condition)
{
body;
++/--;
}
3. do while loop:
Syntax-
initialization;
do{
++/--;
}while(condition)
-Where(++/--) shows the increament/decreament of the variable value.
Entry control loop:
-Loop where condition is check before running the loop is called as Entry control loop.
Example-
for loop
while loop
Exit control loop:
-Loop in which condition is check after running the loop is called as Exit control loop.
Example-
do while loop