Tuesday, 12 February 2013

New Standard Flowchart of for loop.

An ISO committee purposed a new Standard Flowchart of for loop. The previous flowchart of for loop is same as that of while loop. The new flowchart is shown below. Here initialization is the initialization of variable like A = 0 or A = 5, which is the value of variable before loop is executed. The increment/decrement is the updating part like A++ or A—or something like that. Here the variable is either incremented or decremented as according to the need of problem. The exit condition is the condition for a loop to be terminated. If exit condition is met, control is transferred out of the loop body. Note carefully that it is exit condition but not loop condition. For example if a loop condition is A<=10, then exit condition must be A>10

For Loop
.  Now consider a small code segment
for(A = 0; A <= 10; A++){
    printf("Flowchart example");

The flowchart for this statement is 

For Loop Example

No comments:

Post a Comment