Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!bellcore!faline!thumper!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c Subject: Re: Another silly question Message-ID: <9251@alice.UUCP> Date: 27 Apr 89 14:33:11 GMT References: pointer array reference access element <2459@nmtsun.nmt.edu> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 32 In article <2459@nmtsun.nmt.edu>, kelly@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@europa.att.com