Xref: utzoo comp.lang.modula2:1224 comp.lang.c:15854 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!labrea!polya!crew@Polya.Stanford.EDU From: crew@Polya.Stanford.EDU (Roger Crew) Newsgroups: comp.lang.modula2,comp.lang.c Subject: Re: "for" loops (was Re: C++ vs. Modula2) Message-ID: <6419@polya.Stanford.EDU> Date: 28 Jan 89 04:37:58 GMT References: <19579@agate.BERKELEY.EDU> <8515@lanl.gov> Sender: crew@polya.Stanford.EDU Reply-To: crew@Polya.Stanford.EDU (Roger Crew) Followup-To: comp.lang.modula2 Organization: Stanford University Computer Science Dept. Lines: 19 In-reply-to: jlg@lanl.gov (Jim Giles) 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@polya.Stanford.EDU