Re: Memory address and Pointer
- From: Mark McIntyre <markmcintyre@xxxxxxxxxxx>
- Date: Fri, 30 Nov 2007 15:36:21 +0000
erfan wrote:
vc++6.0,winxp.
I use this code to see the memory address and the real value`s
address below:
#include<stdio.h>
int main()
{
int a=22;
int *p;
int i;
p=&a;
printf("%x\n",&a);
printf("%p\n",*p);
}
the result is:
12ff7c
So ,next,i use win Debug to help me.
-d 0012:ff7c
but the output is 00 00 00 00 00 00 00 00 00......
ignoring the errors in printf which others have commented on, the above isn't likely to work anyway. In most modern OSes, programmes have their own memory space and another application normally can't invade that. Also the 'debug' app you're using seems to be a 16-bit app, and the address format you're supplying looks very much like a 16-bit format. Neither of these will be valid ways of accessing data in a 32-bit programme in different memory space!
.
- References:
- Memory address and Pointer
- From: erfan
- Memory address and Pointer
- Prev by Date: Re: Reading a table
- Next by Date: Re: is this correct C? (char*)spm += spm->partitionMapLength;
- Previous by thread: Re: Memory address and Pointer
- Next by thread: make & nmake, cl & gcc
- Index(es):
Relevant Pages
|