I'm not really sure what the order here is. Is it: 1) Dereference the value of pointer p after increasing it 2) Dereference the value of pointer p before increasing it
There is no ordering between the increment and the dereference. However, the *
operator applies to the result of p++
, which is the original value of p
prior to the increment.
In the operators table, you can see that the suffix operator ++
have higher place than the *
unary operator.
Hence, *p++
increase p
(and not *p
), and return the value of the address that p
contained before the increment (since it's the suffix ++
).
But the order is implementation-depend. It may begin by dereferencing p, and then increase it, and it may store the old value of p
, increase it, and then dereference the old value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With