p[1] vs. *(p+1)

Eric Hunter hunter at Oswego.EDU
Tue Sep 4 03:32:50 AEST 1990


In <0901 at sheol.UUCP> throopw at sheol.UUCP (Wayne Throop) writes:

>Or to try putting it another way, I think it is misleading to say that
>"adding one to p 'really' adds sizeof(*p) to p".  I disagree.  I say it
>"really" adds 1, and the result points at an element in the array into
>which p points which is offset exactly 1 array element from where p points.

It doesn't "really" add 1; it increments the pointer variable to the next
available address.

Eric.
-------------------------------------------------------------------------------
| Eric Hunter              | The difference between emacs, and vi, is like the| 
| hunter at oswego.oswego.edu | difference between making love, and masturbation.| 
-------------------------------------------------------------------------------



More information about the Comp.lang.c mailing list