本文介绍了将地址指向指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在以下代码中: 不安全的等级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 " Vlad" <一个********* @ gmail>。在消息中写道 news:11 ********************** @ o13g2000cwo.googlegr oups ... 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 "Vlad" <a.*********@gmail> wrote in message news:11**********************@o13g2000cwo.googlegr oups... 在下面的代码中: 不安全的类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 " Vlad" <一个********* @ gmail>。在消息中写道 news:11 ********************** @ o13g2000cwo.googlegr oups ... 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 "Vlad" <a.*********@gmail> wrote in message news:11**********************@o13g2000cwo.googlegr oups... 在下面的代码中: 不安全的类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 ?
更多推荐
将地址指向指针
发布评论