为什么人们称地址为“指针”? [英] Why do people call addresses "pointers"?

查看:103
本文介绍了为什么人们称地址为“指针”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我只是想知道为什么人/书/专家说该函数会返回一个

指针...或者我们必须向scanf发送指向...的指针。而不是

函数返回...的地址。或者我们必须发送scanf

地址..


不是称为POINTER TO和(r)的左值价值叫做

ADDRESS OF?


为什么人们会把程序中的(r)值称为

指针? (我是否遗漏了一些东西,或只是读了太多的

非问题?)


[我注意到专家们几乎从未说过 ;地址,但经常

时间初学者做...必须有一些东西]

Hi,

I''m just wondering why people/books/experts say "the function returns a
pointer to.." or "we have to send scanf a pointer to.." instead of "the
function returns the address of.." or "we have to send scanf the
address of.."

Isn''t the lvalue called a POINTER TO and the (r)value called the
ADDRESS OF?

Why do people refer to the (r)values moving around in a program as
pointers? (Am I missing something, or just reading too much into a
non-issue?)

[I''ve noticed that experts almost never say "address of", but often
time beginners do... there must be something to it]

推荐答案

在文章< 11 ********************** @ f14g2000cwb.googlegroups .com> ;,

TTroy< ti *****@gmail.com>写道:
In article <11**********************@f14g2000cwb.googlegroups .com>,
TTroy <ti*****@gmail.com> wrote:
我只是想知道为什么人/书/专家说该函数返回指向...的指针。或者我们必须向scanf发送指向...的指针。而不是
函数返回...的地址。或者我们必须发送scanf
地址。


指针只是一个更抽象的术语,而地址更多是实现性的b $ b。例如,您可以使用索引将

大数组中的索引作为指针,在其他一些

语言中实现C而无法访问实际地址。

[我注意到专家们几乎从未说过地址,但往往是时间初学者所做的......必须有一些东西]
I''m just wondering why people/books/experts say "the function returns a
pointer to.." or "we have to send scanf a pointer to.." instead of "the
function returns the address of.." or "we have to send scanf the
address of.."
Pointer is just a more abstract term, while address is more
implementational. You could for example implement C in some other
language without an access to real addresses, by using indexes into a
large array as pointers.
[I''ve noticed that experts almost never say "address of", but often
time beginners do... there must be something to it]




C标准(在大多数地方)使用术语指针。


- Richard



The C standard (in most places) uses the term "pointer".

-- Richard




" TTroy" < TI ***** @ gmail.com>在消息中写道

news:11 ********************** @ f14g2000cwb.googlegr oups.com ...

"TTroy" <ti*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...


我只是想知道为什么人/书/专家说该函数返回指向...的指针。或者我们必须向scanf发送指向...的指针。而不是
函数返回...的地址。或者我们必须发送scanf
地址。


AFAIK"指针"是一个逻辑结构,通常(在C中)解析

到一个地址。对于大多数C编译器而言,这两个术语是等价的,但这并不总是如此。特别是所有类型的段构造都可以使b
模糊化问题。

不是称为指针的左值和称为
ADDRESS的(r)值的?


Nope。

为什么人们会将程序中的(r)值称为指针? (我错过了什么,或者只是读了太多的问题?)


我怀疑是后者。

[我'已经注意到专家们几乎从未说过地址,但往往是时间初学者所做的......必须有一些东西可以做到这一点]
Hi,

I''m just wondering why people/books/experts say "the function returns a
pointer to.." or "we have to send scanf a pointer to.." instead of "the
function returns the address of.." or "we have to send scanf the
address of.."
AFAIK "pointer" is a logical construct, which is usually (in C) resolved
into an adress. For most C compilers the two terms are equivalent, but this
is not always the case. Specifically all kinds of segment constructions can
fuzzify the issue.
Isn''t the lvalue called a POINTER TO and the (r)value called the
ADDRESS OF?
Nope.
Why do people refer to the (r)values moving around in a program as
pointers? (Am I missing something, or just reading too much into a
non-issue?)
I suspect the latter.
[I''ve noticed that experts almost never say "address of", but often
time beginners do... there must be something to it]




地址更清楚,但并不总是正确的。



Address of is clearer, but not always correct.




TTroy < TI ***** @ gmail.com>在消息中写道

news:11 ********************** @ f14g2000cwb.googlegr oups.com ...

"TTroy" <ti*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...


我只是想知道为什么人/书/专家说该函数返回指向...的指针。或者我们必须向scanf发送指向...的指针。而不是
函数返回...的地址。或者我们必须发送scanf
地址..

不是称为POINTER TO的左值和称为
ADDRESS的(r)值OF?
Hi,

I''m just wondering why people/books/experts say "the function returns a
pointer to.." or "we have to send scanf a pointer to.." instead of "the
function returns the address of.." or "we have to send scanf the
address of.."

Isn''t the lvalue called a POINTER TO and the (r)value called the
ADDRESS OF?




表达式的值可以是地址,是的。但是

告诉你关于值的类型是什么?


左值不一定是指针。请考虑以下事项,


int foo;


foo = 10;


是foo a指针?

如果您回答是,那么我建议您在C上买一本书。


-

j



The value of an expression can be an address, yes. But just what does
that tell you about the type of the value?

An lvalue is not necessarily a pointer. Consider the following,

int foo;

foo = 10;

Is foo a pointer?
If you answered ``yes'''', then I recommend you buy a book on C.

--
j


这篇关于为什么人们称地址为“指针”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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