Pointers?

We all know a pointer's main function is to hold the address of another variable. But a thought that just came into my mind: does a pointer variable have its own address within the memory or no?
Yes.
1
2
3
4
5
6
7
8
9
10
#include <iostream>

int main(){
    int a=0;
    int *b=&a;
    std::cout <<*b<<std::endl
        <<b<<std::endl
        <<&b<<std::endl;
    return 0;
}
sure, you can even have a pointer who refers to another pointer. And the another pointers refers to the adress of the first pointer
Last edited on
You can have 3 levels of pointing I think. I had a pointer to an array (which is a pointer) of C strings (which are pointers).
Chris : I don't think there is a (that low) limit for pointer-pointers.
Of course it does. Pointers are variables, and all variables have an address in the RAM.
... except those optimised into registers.
Topic archived. No new replies allowed.