|
From: Michael C U. <mu...@cb...> - 2004-01-31 15:59:04
|
Brian, > int *point = 0x241xff5f; > cout << *point; This doesn't work because it changes the value that *point contains. Remembet that * is the dereference operator. It access the value rather than the address. To access the pointer itself, you don't want anything before it. So here is an example to do what you want: int *point; /* declare a pointer */ point = 0x241xff5f; /* change the address that it points to */ cout < *point; /* derefernce the poiner and print its value */ Notice that i don't use any operator when assigning the value to point. That's because I want to change the actual address that point is point at, rather than change the value that the current address of point contains. Of course, the above example is only useful if you know that the address contains an int value. Also, if you try to access a memory address that doesn't belong to your program, Windows might catch you and kill your program. So make sure you know that the address you assign to point is actually "owned" by your program. Hope this helps, Mike |