0x241f8e0 0x241f8e4 0X241f8e8 0x241f8ec 0x241f8f0
0x241f8f4 0x241f8f8 0x241f8fc 0x241f900 0x241f904

After printing adress of a 2D Array of size 2x5... this is the out-put printed...can someone help mi with explaining the trend.....Is it something like printing consecutive memory blocks??? please help mi out of my confusion..... thanks in advance for your help...

8 Years
Discussion Span
Last Post by GDICommander

It's printing the address of where it was stored in the computer.

Say you had an array called x, and you wanted to print out x[0]. Right now, you are telling it to print out the address of where x[0] was stored on your computer. What you really want is it to print out the value.

If you post up your code, I can help you find the error.


I think that you are using pointers and you are printing the pointer and not its content.

For example, you may be doing this:

int* a = new int(5);
cout << a; //This prints 0xsomething...
cout << *a; //This prints 5
delete a;

Maybe you should do:

cout << (*(*array)[j]);

Or just:

cout << **array[j];

Or just a * on front of what you want to print is necessary.

That's the beauty and the shame of C++: the syntax!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.