OK. So, here is a link to a table of operator precedence. At the bottom, it talks about the increment and decrement operators, saying that they have a high (the highest) precedence, but the actual action doesn't take place until later... so what good does the higher precedence do?

Also, I can't seem to figure it out, what does `*a++ = *b++` do?

Thanks,
Cody

2
Contributors
1
2
Views
8 Years
Discussion Span
Last Post by vmanes

Stated that way, it its a bit of a confusing thing. But, your second question can help put it into perspective.

I'm assuming a and b are pointers to arrays of some type. The * would dereference the pointers, giving you the values pointed to. So the value b points to is assigned to the value a points to. Then a and b (the pointers) are incremented, so that they then point to the next values in the arrays. Precedence comes into play in that the post-increment operators associate to a and to b, the pointers, not to *a and *b, the stored values.

Does that help?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.