Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!bu.edu!husc6!contact!ileaf!io!prs From: prs@io.UUCP (Paul Schmidt) Newsgroups: comp.lang.c Subject: Re: p[1] vs. *(p+1) Message-ID: <1745@io.UUCP> Date: 29 Aug 90 17:11:35 GMT References: <1881@jura.tcom.stc.co.uk> <3603@goanna.cs.rmit.oz.au> <1990Aug24.064203.20942@icc.com> <26D952F5.4E44@tct.uucp> Reply-To: prs@eng.ileaf.com (Paul Schmidt) Organization: Interleaf, Cambridge, MA Lines: 12 In article <26D952F5.4E44@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: > >Any compiler that considers "*(p+1)" and "p[1]" to be different does >not comply with the ANSI standard -- or with K&R, for that matter. So, that means that the compiler must know the size of the elements of array p, and that *(p+1) does not add 1 to p, but instead adds sizeof(array_element_type) to p? I must confess that I use p[1] in these cases, and count on the compiler to optimize for me.