将地址指向指针 [英] Assing address to pointer

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

问题描述

在以下代码中:


不安全的等级X

{

byte * _address;

void test()

{

_address =(byte *)144220152;

}


}


为什么监视窗口显示_address变量的不同地址



In the following code:

unsafe class X
{
byte* _address;
void test()
{
_address=(byte*)144220152;
}

}

Why the watch windows shows a differtent address for _address variable
?

推荐答案

Vlad,


你确定你没有看到

数字的十六进制格式吗?它是否会显示8989FF8(这是十六进制中的相同值

格式)?


希望这会有所帮助。

- -

- Nicholas Paldino [.NET / C#MVP]

- mv * @ spam.guard.caspershouse.com


" Vlad" <一个********* @ gmail.com>。在消息中写道

news:11 ********************** @ o13g2000cwo.googlegr oups.com ...
Vlad,

Are you sure you are not looking at the hexidecimal format for the
number? Does it show you 8989FF8 instead (this is the same value in hex
format)?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Vlad" <a.*********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
在下面的代码中:

不安全的类X
{
byte * _address;
void test()
{
_address =(byte *)144220152;
}


为什么监视窗口显示_address变量的不同地址
In the following code:

unsafe class X
{
byte* _address;
void test()
{
_address=(byte*)144220152;
}

}

Why the watch windows shows a differtent address for _address variable
?



感谢您的帮助,但问题不是十六进制格式

Thanks for your help, but the problem isn''t hexidecimal format


Vlad,


好​​吧,我将_address字段和测试方法更改为公共,然后

然后在运行测试后将_address的值写入控制台。

的值是相同的。


必须有其他更改它的东西,但代码中没有显示

你发布。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Vlad" <一个********* @ gmail.com>。在消息中写道

news:11 ********************** @ o13g2000cwo.googlegr oups.com ...
Vlad,

Well, I changed the _address field and the test method to be public, and
then wrote the value of _address out to the console after I ran test. The
value was the same.

There must be something else changing it which is not shown in the code
that you posted.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Vlad" <a.*********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
在下面的代码中:

不安全的类X
{
byte * _address;
void test()
{
_address =(byte *)144220152;
}


为什么监视窗口显示_address变量的不同地址
In the following code:

unsafe class X
{
byte* _address;
void test()
{
_address=(byte*)144220152;
}

}

Why the watch windows shows a differtent address for _address variable
?



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

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