go to previous page   go to home page   go to next page

Answer:

Yes. It is regarded as an if-then-else with an empty else-branch.


Structure Rule Four: Iteration

structure rule four

Iteration (while-loop) is arranged as at right. It also has one entry point and one exit point. The entry point has conditions that must be satisfied and the exit point has conditions that will be fulfilled. There are no jumps into or out of the structure.

Rule 4 of Structured Programming: The iteration of a code block is structured.

In C, iteration may be implemented with a while statement.

while ( condition )
  statement

condition is an expression that evaluates to zero (regarded as false) or non-zero (regarded as true). statement is executed when condition is true, then control returns to the while. Almost always, the statement is a code block:

while ( condition )
{
  block
}

The statement or block that follows the while should ensure that condition will eventually become zero (false) and end the loop.


QUESTION 12:

What other statement in C is used for iteration?