The for operator consists of three expressions and an executable operator:
Expression1 describes the loop initialization. Expression2 checks the situations of the loop termination. Whether it is true, the loop physique for is executed. The loop repeats expression2 till it turns into false. Whether it is false, the loop is terminated, and management is given to the subsequent operator. Expression3 is calculated after every iteration.
The for operator is equal to the next succession of operators:
Any of the three or all three expressions might be absent within the for operator, however the semicolons (;) that separate them should not be omitted. If expression2 is omitted, it’s thought-about consistently true. The for(;;) operator is a steady loop, equal to the whereas(1) operator. Every expression 1 or three can include a number of expressions mixed by a comma operator ‘,’.
Initialization of Variables, Visibility Scope and Lifetime of Variables, Creating and Deleting Objects