program for pointer to a pointer in C++

Program for pointer to a pointer in C++

#include<iostream>
using namespace std;
int main()
{
int *p,**pp;
int x;
p=&x; //pointer p stores the address of variable x
pp=&p; // double pointer stores the addres of pointer p
cout<<"the address of x is : "<<p<<endl; //prints the address of variable x
cout<<"the address of pointer p is : "<<pp<<endl;//prints the address of pointer p
}

output:
the address of x is : 0x6ffdfc
the address of pointer p is : 0x6ffe00

Comments