地址和指针之间的区别 [英] difference between address and pointer

查看:81
本文介绍了地址和指针之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。


我想知道以下信息。


1)地址和整数之间是否有任何区别?


例如假设int x = 500;

并且int y = 10;

假设y的地址也是500 ;

我怀疑x

的价值属性和y的地址是500.


此致,

Somenath

Int x = 500;

Hi All.

I would like to know the following information.

1)Is there any difference between the address and integer ?

For example suppose int x = 500;
And int y =10;
Suppose address of y is also 500;
My doubt is there any difference between the properties of value of x
and address of y which is 500.

Regards,
Somenath
Int x =500;

推荐答案

somenath写道:
somenath wrote:

我想知道以下信息。


1)地址和整数之间是否有任何区别?
I would like to know the following information.

1)Is there any difference between the address and integer ?



地址(和指针)与整数不同。

Addresses (and pointers) are different from integers.


例如假设int x = 500;

和int y = 10;

假设y的地址也是500;
For example suppose int x = 500;
And int y =10;
Suppose address of y is also 500;



不是。 500是整数; y的地址是指针。他们

是两种可区分的类型/即使/底层机器使用

整数类位模式作为指针和整数运算来

do地址计算。

It isn''t. 500 is an integer; the address of y is a pointer. They
are two distinguishable types /even if/ the underlying machine uses
integer-like bit-patterns as pointers and integer arithmetic to
do address calculations.


我怀疑x

的值属性和y的地址是500.
My doubt is there any difference between the properties of value of x
and address of y which is 500.



是的。例如,将整数与另一个整数相乘是合法的,

但是不能将地址乘以整数。整数值可以分配给浮动变量
;地址不能。你不能

取消引用一个整数。等等。


-

克里斯几乎但并非完全不同 Dollin


Hewlett-Packard Limited注册办公室:Cain Road,Bracknell,

注册号:690597 England Berks RG12 1HN

Yes. For example, it''s legal to multiply an integer by another integer,
but not to multiply an address by an integer. Integer values can
be assigned to floating variables; addresses cannot. You cannot
dereference an integer. Etc.

--
Chris "almost but not quite completely different" Dollin

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN


somenath写道:
somenath wrote:

大家好。


我想知道以下信息。


1)地址和整数之间有什么区别吗?


例如假设int x = 500;

和int y = 10;

假设y的地址也是500;

我怀疑x的值属性是否有任何区别/>
和y的地址是500.
Hi All.

I would like to know the following information.

1)Is there any difference between the address and integer ?

For example suppose int x = 500;
And int y =10;
Suppose address of y is also 500;
My doubt is there any difference between the properties of value of x
and address of y which is 500.



这个问题在小组中经常被打破。在Google网上论坛中进行一点点扫描

可能会找到最近的讨论...


现在两点: -

1)指针的格式没有由C标准定义

2)并非所有系统都具有平坦状态。地址空间,所以

地址是一个整数的想法是不可移植的。

This question is regularly thrashed over in the group. A little scanning
in Google Groups would probably find the most recent discussion...

Two points for now:-
1) The format of a pointer is not defined by the C standard
2) Not all systems have "flat" address spaces, so the idea that an
address is an integer is not portable.


somenath写道08/09/07 10:12 ,:
somenath wrote On 08/09/07 10:12,:

大家好。


我想知道以下信息。


1)地址和整数之间有什么区别吗?


例如假设int x = 500;

和int y = 10;

假设y的地址也是500;

我怀疑x

的值属性和y的地址之间有什么区别是$ 500.
Hi All.

I would like to know the following information.

1)Is there any difference between the address and integer ?

For example suppose int x = 500;
And int y =10;
Suppose address of y is also 500;
My doubt is there any difference between the properties of value of x
and address of y which is 500.



其他受访者通过显示地址不是
不是整数>
整数。但差异更深一些:指针

不仅仅是一个地址。考虑一下这个代码片段

,你会理解为什么一个指针比地址更多




联盟{double d; int i; } u;

double * dp =& ud;

int * ip =& ui;


在此代码中,两个指针dp和ip指向

相同的内存位置。尽管如此,它们是不同的。

是什么让它们与众不同?


-
Er ********* @ sun.com


这篇关于地址和指针之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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