Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!telxon!gorpong From: gorpong@telxon.UUCP (Gordon C. Galligher) Newsgroups: comp.lang.c Subject: Re: Correction, a[33] Summary: No, it was right the first time. Message-ID: <55@telxon.UUCP> Date: 27 May 89 22:13:40 GMT References: <5819@microsoft.UUCP> Reply-To: gorpong@telxon.UUCP (Gordon C. Galligher) Distribution: usa Organization: Telxon Corporation, Akron Ohio Lines: 37 In article <5819@microsoft.UUCP> t-iaind@microsoft.UUCP (Iain Davidson) writes: >.. > >Something that went un-noticed in a few messages: > >char a[33] > >is not an array of 33*sizeof (int) but really 34 slots !!!!! > >Remember C is start base 0 not 1. > >0..33 = 34 slots of int's. ^^^^^^^^^^^ int foo[33] :==> 0..32, not 0..33. K&R1: Page 20 1.6 Arrays ... The declaration int ndigit[10]; declared ndigit to be an array of 10 integers. Array subscripts always start at zero in C (rather than 1 as in Fortran or PL/1), so the elements are ndigit[0], ndigit[1], ..., ndigit[9]. [**] K&R2: Page 22 is exactly the same excluding the part in parentheses. -- Gordon. -- Gordon C. Galligher <|> ...!uunet!telxon!gorpong <|> gorpong@telxon.uucp.uu.net Telxon Corporation <|> "Before they warped out of orbit I beamed the whole kit Akron, Ohio, 44313 <|> and kabootle into their engine room." - Scotty (216) 867-3700 (3512)<|> (Trouble with Tribbles)