Write a program to print the address of a variable whose value is input from user.
#include<iostream>usingnamespacestd;intmain(){intx;cout<<"Enter a number\n";cin>>x;cout<<"Address is "<<&x<<"\n";return0;}
2.
Write a program to print the address of the pointer to a variable whose value is input from user.
3.
Write a program to print the value of the address of the pointer to a variable whose value is input from user.
#include<iostream>usingnamespacestd;intmain(){intx,*y;cout<<"Enter a number\n";cin>>x;y=&x;cout<<"Value of the address of pointer of "<<x<<" is "<<&y<<"\n";return0;}
4.
Write a program to print a number which is entered from keyboard using pointer.
#include<iostream>usingnamespacestd;intmain(){intx;cout<<"Enter a number\n";cin>>x;cout<<*(&x)<<"\n";return0;}
5.
Write a function which will take pointer and display the number on screen. Take number from user and print it on screen using that function.
#include<iostream>usingnamespacestd;voidprint(int*a){cout<<*a<<"\n";}intmain(){intx;cout<<"Enter a number\n";cin>>x;print(&x);return0;}
6.
Write a program to find out the greatest and the smallest among three numbers using pointers.
Level 2
1.
Write a program to find the factorial of a number using pointers.
2.
Write a program to reverse the digits a number using pointers.