home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!Informatik.Uni-Dortmund.DE!fbi-news!grossjoh
- From: grossjoh@petty.ls6.informatik.uni-dortmund.de (Kai Grossjohann)
- Newsgroups: comp.lang.c++
- Subject: basic question
- Date: 20 Nov 92 19:22:07
- Organization: Universitaet Dortmund, Lehrstuhl Informatik VI
- Lines: 38
- Distribution: world
- Message-ID: <GROSSJOH.92Nov20192207@petty.ls6.informatik.uni-dortmund.de>
- Reply-To: Kai Grossjohann <grossjoh@ls6.informatik.uni-dortmund.de>
- NNTP-Posting-Host: petty
-
- Hi all,
-
-
- this has GOT to be a FAQ, but I ask anyway: Suppose I have:
-
- int i;
- for ( i=0; i<10; i++ ) {
- cout << "Hey, you!" << endl;
- }
-
- After the loop, can I _rely_ on the fact that i==10? I mean, what does the
- language specification say? I really don't want to do anything that's not
- allowed here, but I hesitate to write
-
- int i; int j;
- j = 0;
- for ( i=0; i<10; i++ ) {
- cout << "Hey, you!" << endl;
- j++;
- }
-
- and then use the fact, that after the loop, j==10.
-
- What do you think?
-
- Thanx for your help?
-
- -- Kai
- --
- --
- Kai Grossjohann Phone (voice): 49 231 75 30 15
- Baroper Str. 331 App. 510 E-Mail:
- W-4600 Dortmund 50 grossjoh@ls6.informatik.uni-dortmund.de
- Germany
- --
- There are two ways to solve this problem: the hard way, and the
- easy way. Let's start with the hard way.
- -- W. Schneider, from a Physics lecture
-