m2skills

swap3

Mar 29th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.18 KB | None | 0 0
  1. // method that swaps numbers using ^ ( ex-or ) operations
  2. void swap3(int *num1, int *num2){
  3.     *num1 = *num1 ^ *num2;
  4.     *num2 = *num1 ^ *num2;
  5.     *num1 = *num1 ^ *num2;
  6.    
  7.     return;
  8. }
Add Comment
Please, Sign In to add comment