for <==> while (an exception)

M.J.Shannon mjs at eagle.UUCP
Sat Jul 13 04:24:50 AEST 1985


> Section 3.5 of K&R (p. 56) states that the 'for' loop and 'while' loop
> can be made equivalent....
> 
> Well ... almost.
> If 'statement' contains a 'continue' statement, things may go awry.

If you look in the reference manual which is contained in K&R, you will see
that the semantics of the continue statement are fully described in terms of
equivalences among while, do-while, and for loops.  Section 9.9 (p. 203) clears
up the `exception' you perceive.  Please bear in mind that the section that you
quoted is part of a tutorial, and so all the gory details aren't presented at
once or in the same place.
-- 
	Marty Shannon
UUCP:	ihnp4!eagle!mjs
Phone:	+1 201 522 6063



More information about the Comp.lang.c mailing list