stv*_*per 5 c c++ addressof operator-precedence ampersand
我们有两行代码:
&car->speed
&(car->speed)
Run Code Online (Sandbox Code Playgroud)
speed?这两条线是否相同?我会在两种情况下都能达到速度吗?
是.->具有比一元的高优先&,因此&car->speed和&(car->speed)是相等的.
如果它们是等价的,那么最好选择哪种编码约定?
使用秒,因为它显示了您对地址感兴趣的预期行为speed.