#include <iostream>
using namespace std;

int main()
{
	 //Q1
	 {
	 int a=1,b=2,*ptr;
	 ptr=&b;
	 cout<<"For question 1\n";
	 cout<<"Value of b is "<<b<<endl;
	 cout<<"The address of b is "<<&b<<endl;
	 cout<<"The value of ptr is "<<ptr<<endl;
	 cout<<"The value of *ptr is "<<*ptr<<endl;
	 }
	 
	 //Q2
	 {
	 int a=1,b=2,*ptr=&b;
	 a=*ptr;
	 cout<<"\nFor question 2\n";
	 cout<<"Value of a is "<<a<<endl;
	 cout<<"Value of b is "<<b<<endl;
	 cout<<"The address of a is "<<&a<<endl;
	 cout<<"The address of b is "<<&b<<endl;
	 cout<<"The value of ptr is "<<ptr<<endl;
	 cout<<"The value of *ptr is "<<*ptr<<endl;
	 }
	 
	  //Q3
	  {
	  int a=1,b=2,c=5,*ptr=&c;
	  b=*ptr;
	  *ptr=a;
	  cout<<"\nFor question 3\n";
	  cout<<"Value of a is "<<a<<endl;
	  cout<<"Value of b is "<<b<<endl;
	  cout<<"Value of c is "<<c<<endl;
	  cout<<"The address of a is "<<&a<<endl;
	  cout<<"The address of b is "<<&b<<endl;
	  cout<<"The address of c is "<<&c<<endl;
	  cout<<"The value of ptr is "<<ptr<<endl;
	  cout<<"The value of *ptr is "<<*ptr<<endl;
	 }
	 
	 //Q4
	 {
	 int a=1,b=2,c=5,*ptr;
	 ptr=&c;
	 c=b;
	 a=*ptr; 
	 cout<<"\nFor question 4\n";
	 cout<<"Value of a is "<<a<<endl;
	 cout<<"Value of b is "<<b<<endl;
	 cout<<"Value of c is "<<c<<endl;
	 cout<<"The address of a is "<<&a<<endl;
	 cout<<"The address of b is "<<&b<<endl;
	 cout<<"The address of c is "<<&c<<endl;
	 cout<<"Value of ptr is "<<ptr<<endl;
	 cout<<"Value of *ptr is "<<*ptr<<endl;
	
	 }
	 
	 return 0;
}
