Let's have two lines of code:
&car->speed
&(car->speed)
speed
?Are these two lines equivalent? Will I get in both cases address to the speed?
Yes. ->
has higher precedence than that of unary &
, therefore &car->speed
and &(car->speed)
are equivalent.
If they are equivalents, what is better to choose as coding convention?
Go with second as it shows the intended behaviour that you are interested in the address of speed
.