Suppose if you want to execute certain statements for multiple times then you have to write them multiple times which make the program complicated and lenghty. To overcome this problem C language provides a feature called as looping.
Looping is a process in which given blocks of statements repeatedly executes till the condition is true. Looping is one of the most important concept in C programming language. Looping allows us to save our time by minimizing the number of statements which makes the program smaller and also helps to save our time.
In C programming language there are four types of looping statements:
- while loop
while loop is used to execute blocks of statements repeatedly until the condition returns false.
For more about while loop visit my article on while loop in C.
- do..while loop
do..while loop is similar to while loop except, in do while loop the loop body is executed at least one time even if the condition is false.
For more about do..while loop visit my article on do..while loop in C.
- for loop
for loop is a controlled loop which uses three expressions among which first is the initialization, second is the test condition and the last one is the counter updater.
For more about for loop visit my article on For loop in C.