Another silly question
Andrew Koenig
ark at alice.UUCP
Fri Apr 28 00:33:11 AEST 1989
In article <2459 at nmtsun.nmt.edu>, kelly at nmtsun.nmt.edu (Sean Kelly) writes:
> My CS instructor and I disagree about a certain moot point. I have a text
> book which says that
> *(a + i) and a[i]
> are equivalent, given an array a, and int index i ... each gives the
> value stored in a[i]. But he says that
> *(a + i)
> is non-standard and would not expect it do go far on all _real_ C compilers
You are right, *(a + i) is precisely equivalent to a[i].
Any compiler that gets that wrong is badly broken.
Moreover, many programs say
a + i
instead of
&a[i]
so there is a fair premium on getting at least that part of it right.
You might ask your instructor for an example of a compiler that
doesn't get *(a + i) right.
--
--Andrew Koenig
ark at europa.att.com
More information about the Comp.lang.c
mailing list