I am just learning the concept of pointers in c++. From what I have studied I understand that &
is used for finding memory address of a variable. I want to ask if there is also memory address of a pointer. Take a look at my code below
#include <iostream>
using namespace std;
int main() {
int fish=5;
int *fishpointer=&fish;
cout << fishpointer << endl;
cout << &fishpointer << endl;
return 0;
}
The above code on run print the following
0x7fff64cc1f14
0x7fff64cc1f18
Each time I run it the both the address changes, but the second address is I think 4 more in value than first. Why that is so? I understand that first address is of variable fish, but not able to understand about second address. Is it just garbage value?