Memory address

0 Moh Sam · June 23, 2014
Whenever I try to print out a memory address using this code(or any other code aiming to print out a memory address) :

#include <iostream>
using namespace std;

int main() {

int x = 5;
cout << &x << endl;


I don't get a hexadecimal but rather something like 002DF888 and this value changes whenever I close and re-run the program. I guess the problem is with the software I'm using rather than the code since the code looks valid to me. Any idea how to fix that?
PS : I use Microsoft Visual Studio 2012.

Post a Reply


Oldest  Newest  Rating
0 Moh Sam · June 24, 2014
It is not a meaningful problem . I'm just starting to learn about pointers and such and using this code , I should get a hexadecimal , which is not happening.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator