Correction, a[33]
Gordon C. Galligher
gorpong at telxon.UUCP
Sun May 28 08:13:40 AEST 1989
In article <5819 at microsoft.UUCP> t-iaind at 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 at 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)
More information about the Comp.lang.c
mailing list