Address of a reference

前端 未结 5 1099
北恋
北恋 2021-01-16 02:40

So I am having a discussion with a friend about reference and pointers.

What we got talking about is \"you can take an address of a pointer but you cant take an addr

5条回答
  •  攒了一身酷
    2021-01-16 03:12

    You can think of references as aliases for objects. So, in your example, &xRef declares xRef which is another name for x. Hence you're printing twice the adress of the same object.

提交回复
热议问题