Hello I'm trying to display the memory location(s) of an array of pointers. It works, but it prints the memory locations out as:



I know that is the memory location, but in other examples, I've seen it being displayed as


Here is the function:

void display_pointer(int theSize)
    int counter = 0;
    for(int i=0; (i < theSize); i++)
        char thePointer = myInt[i];
        char* ipPtr[theSize];
        ipPtr[i]= &thePointer;
        cout << *ipPtr[i];
        if(counter == 11)
            cout << "(" << &ipPtr[i] << ")";
            counter = 0;

Thanks =)

A memory location has an address. Depending on your system the size of that address will vary. If you need to address 64 bits you will need more digits than addressing 32 bits. You may have been seen a hypothetical scenario where the numbers were used to in crease clarity and not necessarily to represent a true environment.

This article has been dead for over six months. Start a new discussion instead.