打印指针的地址 [英] Print the address of pointer

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

问题描述

你好,

我想打印指针的地址,以查看程序运行(exe寿命)期间是否发生了变化.

我写道:

Hello,

I would like to print address of pointer in order to see if is changing during program run ( exe life ).

I wrote:

char	DebugString[100];
uint8	*m_pPointer;
void *val1 = pPointer;
sprintf_s(DebugString,"pPointer: %d\n",val1);
OutputDebugString(DebugString);




是打印指针地址的正确方法吗?
指针地址在整个exe生命中都应该是永久的吗?

谢谢,

Tal.




Is it the right way to print address of a pointer?
Should the pointer address be permanent during all exe life?

Thanks,

Tal.

推荐答案

我认为您需要一个指向指针的指针.阅读此内容:

指向指针的指针

-------------------------------
问候

H.Maadani
I think you need a pointer to pointer. read this :

Pointer to pointer

-------------------------------
Regards

H.Maadani


如果要打印pPointer变量的地址,则可以使用&运算符来获取地址的地址 pPointer,如下所示:

If you want print the address of the pPointer variable, you can use the & operator to obtain the address of pPointer, like the following:

void *val1 = &pPointer;


使用应使用 p指定符 [
Use should use the p specifier[^].
sprintf_s(DebugString,"pPointer: %p\n",val1);


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

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