"Mark Stokes" <m.sto...@ieee.org> writes:

> I've been pulling my hair out about an auto increment problem.  I
> finally realized the following statement wasn't acting as I expected it

[snip]

>     *address++;

[snip]

> Is this a bug?

No, it's not a bug; ++ has higher precedence than *. That's why you
can do things like

   char *s;
   s = "this is a test";
   while (*s != '\0') putchar(*s++);


So, to get what you want, you could write

    (*address)++;

but IMO, your "fix" looks nicer:

    *address += 1;



Regards,
   --Daniel



Reply via email to