On Fri, Feb 17, 2006 at 11:39:51PM -0800, Tony Newman wrote:
> Fred James wrote:
[..]
> >printf( "%c\n", *Aptr+7);
[..]
>
> I think what is happening is the dereference operator is binding
> "tighter" than the pointer arithmetic.
>
> This gives the equivalent of:
>
> printf( "%c\n", (*Aptr) + 7 );
>
> instead of what you want:
>
> printf( "%c\n", *(Aptr + 7) );
Correct. If you want to add 7 to the value dereferenced, (*Aptr) + 7 is
what you want, and you get that with *Aptr + 7 autmatically. If you want
Aptr + 7 to be dereferenced, you need the () around the expression.
--
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit."
-- Aristotle
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug