Richard Heathfield <> wrote:
> wrote:
>
>> Is *ptr++ equivalent to *(ptr++) ?
>
> Yes. In each case, the associativity is right-to-left and, in each case, the
I don't think "associativity" is the right word here, as they are
unary operators. "Precedence" is more appropriate, I think.
> value seen by * is the old value of ptr, not the new value that it will
> have when ++ has completed its work.
There's a rule of thumb for unary operators in C, first you read ones
to the right, then ones to the left (unless, of cource, paretheses
override this).
A couple of (non-trivial) examples:
*p++
++p[i];
*p[i]
&a[i]
++p->m
(type*)p->m
*p()
(But I haven't really made sure that it always works; and `sizeof' is
special.)
--
Stan Tobias
mailx `echo
LID | sed s/[[:upper:]]//g`