// Swapping two values via pointers
#include <iostream>
using namespace std;

void swap(int *, int *);

int main()
{
  int x = 22, y = 33;

  cout << "Values before swapping: "
       << x << " " << y << endl;

  swap (&x, &y);

  cout << "Values after  swapping: "
       << x << " " << y << endl;

  return 0;
}

void swap(int* x, int* y){
  int z = *x;
  *x = *y;
  *y = z;
}
