From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9145ae4c60f297377e27722c38bd8449@swtch.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] A Plan 9 C request.... From: "Russ Cox" Date: Wed, 1 Mar 2006 13:32:43 -0500 In-Reply-To: <59a908a62c52dd9ff6252fe697d37a87@coraid.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 08830dce-ead1-11e9-9d60-3106f5b1d025 > Does that mean the following will compile? > > 1 void > 2 f(void) > 3 { > 4 i = 3; > 5 put(i); > 6 for (int i = 0; i < 3; i++) > 7 put(i); > 8 if (i == 4) put(4); > 9 } No, because i is undeclared at line 4. It's still not a good example. Here's a better one: void main(void) { int i = 100; for (int i = 0; i < 3; i++) printf("%d\n", i); printf("%d\n", i); } It prints 0 1 2 100. Russ