Friday, July 22, 2011

Introduction to "FOR LOOP" in C and C++ programming language

The general form of the "For loop" statement is

for(exp1;exp2;exp3)
                          {
                           
                           The body of loop (block of statements)


                          } 
It is executed as follow :
  1. Exp1 is evaluated.
  2. Exp2 is evaluated.If it is true (non zero), the body of the for loop is executed, followed by exp3 and this step(2) is repeated. If exp2 is false (zero), the loop terminates and the execution continues with the next statements if any after the for loop.

No comments:

Post a Comment