#include<iostream.h> #include<conio.h> void main() { clrscr(); int *a,*b,*temp; cout<<“Enter value of a and b:”; cin>>*a>>*b; temp=a; a=b; b=temp; cout<<“nAfter swapingna=”<<*a<<“nb=”<<*b; getch(); }
C++ program to swap two numbers using pointers
Levels of difficulty: medium / perform operation: