Posts : 63 Join date : 2010-03-07 Age : 38 Location : Bangalore
Well i don't completely agree with your statement. There are other solutions to the same problem which are capable of handling both +ive and -ve inputs.
The output for your snippet will be 5,6 The swap wont work here because it is 'pass by value' instead if we use swap(*x,*y)- pass by reference The swapping will work fine.