"for" loops (was Re: C++ vs. Modula2)

Ken Arromdee arrom at aplcen.apl.jhu.edu
Sat Jan 28 10:11:29 AEST 1989


>Actually, C's "for" can be duplicated EXACTLY by C's "do ... while" loops.

I suspect you're going to get an awful lot of flames for saying this.  What
about
	for(i=0; i<=j; i++)
		printf("%d\n",i);
Since a do-while loop has the test condition at the termination of the loop,
it is not possible to produce an equivalent do-while version, for the
behavior will differ if j is less than 0.
--
               EARTH                  --Kenneth Arromdee
           smog  |   bricks          UUCP: ....!jhunix!ins_akaa
        AIR     mud       FIRE   INTERNET: arromdee at crabcake.cs.jhu.edu
      soda water |   tequila       BITNET: g49i0188 at jhuvm
               WATER           (please, no mail to arrom at aplcen)



More information about the Comp.lang.c mailing list