Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: net.lang.c Subject: Re: how has C bitten you? Message-ID: <4081@alice.UUCP> Date: Wed, 31-Jul-85 11:33:01 EDT Article-I.D.: alice.4081 Posted: Wed Jul 31 11:33:01 1985 Date-Received: Thu, 1-Aug-85 23:47:12 EDT References: <302@brl-tgr.ARPA> Organization: Bell Labs, Murray Hill Lines: 19 > Andrew: > Regarding > int i,a[10]; > for(i=0; i<=10; i++) > a[i] = 0; > you should have expected some problems, as you are writing one past the end of > the array! The correct test to use is < not <=! Yes, I know that! The point is that this is an example of something that looks reasonable at first glance and isn't, because of a property that C does not share with many other languages (in most languages, a 10-element array has an element #10). Read my article again. I am looking for examples for my collection, not asking for advice on how to solve this particular problem.