Take input in three integers and write a swapping function for ‘a’, ‘b’ and ‘c’. Use pointers to swap the values. Resultant ‘a’ should print the value of ‘b’, and ‘b’ prints the value of ‘c’, and ‘c’ prints the value of ‘a’.?

#include <iostream>
using namespace std;

void swap(int *,int *,int *);
int main()
{
int a ,b ,c;

cout <<“enter a: “;
cin >> a;

cout <<“\nenter b: “;
cin >> b;

cout <<“\nenter c: “;
cin >> c;
cout <<“before swaping a b c”<< endl;

cout <<“a b c “<<a<<” “<<b<<” “<<c<<endl;
swap(&a,&b,&c);

cout <<“after swaping a b c”<< endl;

cout <<“a b c “<<a<<” “<<b<<” “<<c<<endl;
return 0;

 

}
void swap(int *ptr1,int *ptr2,int *ptr3)
{
int temp;
temp=*ptr1;
*ptr1=*ptr2;
*ptr2=*ptr3;
*ptr3=temp;

}