#include<iostream>
using namespace std;
int main()
{
int a=100;
int* ptr1;
int** ptr2;
ptr1=&a;
ptr2=&ptr1;
cout<<"the address of a="<<&a<<endl; //in this we find the address of a
cout<<"the address of a="<<ptr1<<endl; //in this we store the addsress of a in ptr1
cout<<"the address of ptr1="<<ptr2<<endl; //in this we store the address of ptr1 in ptr2
cout<<"the value of a="<<*ptr1<<endl; //in this we display the value of a by pointer ptr1
cout<<"the value of a="<<**ptr2<<endl; //in this we display the value of a by pointer ptr2
cout<<"the vaue of a="<<a<<endl;
}
No comments:
Post a Comment