Loop "Equivalencies"

Roger J. Noe rjnoe at riccb.UUCP
Thu Nov 21 00:07:00 AEST 1985


> In Appendix A (C Reference Manual), p. 202, and p. 56, it says that
> the following:
> 
>     for (expr1; expr2; expr3)
>         statement
> 
> is equivalent to:
> 
>     expr1;
>     while (expr2) {
>         statement
>         expr3;
>     }
> 
> This is not true if "statement" is a block which contains a "continue"
>
> Am I missing something?
> -- Rich Wagner

Nope, you're exactly right.  It should be this way:
	expr1;
	while(expr2) {
		statement
	contin:	expr3;
	}
and should refer to the continue statement a few sections later in appendix A.
--
Roger Noe			ihnp4!riccb!rjnoe



More information about the Comp.lang.c mailing list