top of page

For

初始化,测试,更新

     The for statement uses three control expressions, separated by semicolons, to control a looping process. The initialize expression is executed once, before any of the loop statements are executed. Then the test expression is evaluated and, if it is true (or nonzero), the loop is cycled through once. Then the update expression is evaluated, and it is time to check the test expression
again. The for statement is an entry-condition loop—the decision to go through one more pass of the loop is made before the loop is traversed. Therefore, it is possible that the loop is never traversed.

Form:
     for (initialize ; test ; update)
     statement
     The loop is repeated until test becomes false or zero.
Example:
     for (n = 0; n < 10 ; n++)
     printf(" %d %d\n", n, 2 * n + 1);

© 2023 by Name of Site. Proudly created with Wix.com

bottom of page