for swap function we have two choice: ref-style:

Code:
 void swap (int &a, int &b)
    {
      int temp;

      temp = b;
     b   = a;
     a   = temp;   
   }
and pointer-style:

Code:
  void swap (int *a, int *b)
    {
     int temp;

    temp = *b;
    *b   = *a;
    *a   = temp;   
    }
ref-style absolutely legal but pointer-style have some issue, when we try to use this function variables pass by value not by reference-even they are pointers- in fact we try to use memory of a local variable outside its function, and may by in some day in some machine we have undefined behavior ,