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

Roger Crew crew at Polya.Stanford.EDU
Sat Jan 28 14:37:58 AEST 1989


Here's a quiz:
How would you write the following in C?

	VAR a, b, c : Char;
	...
	FOR c = a TO b DO ... END;

You can even assume that the body of the loop affects neither a nor b.
Hint:  the answer is *not*

	char a, b, c;
	...
	for (c = a; c <= b; ++c) { ... }

(just try a = 0 and b = 255 in the case of 8 bit chars).
--
Roger Crew		Copyright 1989 -- All Rights Reserved.   (so there!)
Usenet:    {arpa gateways, decwrl, uunet, rutgers}!polya.stanford.edu!crew
Internet:  crew at polya.Stanford.EDU	



More information about the Comp.lang.c mailing list