C Loops

Sometimes you have to need to execute a statement multiple time. C loops provide a way to execute a block of statements a fixed number of times based on a condition. In looping a block of statement are executed repeatedly until some condition for termination of the loop are satisfied. A loop consists of two parts. One is body of the loop and the another is the control statement. The control statement tests certain conditions then execute the statements repeatedly contained in the body of the loop.
C language provides following statements for performing loop:

  1. The while statement
  2. The do statement
  3. The for statement


Loop Control Statements

During the loop operation sometimes it is needed to change the normal flow of execution of the loop. There are some loop control statements for handling this kind of situation. They are following:

Statement Description
The break statement It is used to jumping out of a loop and continues with the statement immediately following the loop.
The continue statement It is used to skip a part of a loop and continues with the next iteration.
The goto statement It is used to transfer the current program execution sequence to another part of the program.