p[1] vs. *(p+1)
Paul Schmidt
prs at io.UUCP
Thu Aug 30 03:11:35 AEST 1990
In article <26D952F5.4E44 at tct.uucp> chip at 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.
More information about the Comp.lang.c
mailing list