指针和引用之间的差异是什么 [英] what is the diff between pointer and reference

查看:94
本文介绍了指针和引用之间的差异是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我指针之间的区别是什么?

参考.....哪一个更好用......以及为什么???????

解决方案



man写道:

任何人都可以告诉我什么是指针和
参考之间的差异.....哪一个更好用....以及为什么???????



< a rel =nofollowhref =http://www.parashift.com/c++-faq-lite/references.htmltarget =_ blank> http://www.parashift.com/c++-faq-lite /references.html





a引用就像一个别名。同一事物的不同名称(即

对象或函数)。指针指向

变量/对象的物理地址。


再见,


Oliver


添加到Oliver帖子,应始终初始化参考,

指针不需要。


他们又有许多优点和缺点......书中更多内容


Oliver Block写道:


引用就像别名。同一事物的不同名称(即对象或功能)。指针指向
变量/对象的物理地址。

再见,

Oliver




can any one please tell me what is the diff between pointer and
reference.....and which one is better to use ....and why???????

解决方案


man wrote:

can any one please tell me what is the diff between pointer and
reference.....and which one is better to use ....and why???????



http://www.parashift.com/c++-faq-lite/references.html


Hi,

a reference is like an alias. A different name for the same thing (i.e.
object or function). A Pointer points to the physical address of a
variable/object.

bye,

Oliver


Adding to Oliver post, refferences should always be initialised,
pointer need not be.

they again have many adavantages and disadvantages...more given in book

Oliver Block wrote:

Hi,

a reference is like an alias. A different name for the same thing (i.e.
object or function). A Pointer points to the physical address of a
variable/object.

bye,

Oliver




这篇关于指针和引用之间的差异是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆