UMBC CMSC 201 & 201H Fall '98 | CSEE | 201 | 201 F'98 | lectures | news | help |
For example, the for loop
for (i = 0; i < 10; i++) { printf("The value of i is %d\n",i); }
is equivalent to the while loop
i = 0; while (i < 10) { printf("The value of i is %d\n",i); i++; }
for (<initialize LCV>; <continuation_test>; <update LCV>) { <body of loop> }
is equivalent to
<initialize LCV> while (<continuation_test>) { <body of loop> <update LCV> }