Created
May 20, 2013 18:57
-
-
Save UjwalManjunath/5614585 to your computer and use it in GitHub Desktop.
Swapping two variables without using temp variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void swap(int a. int b ) { | |
a= a^b; | |
b= a^b; | |
a= a^b; // XOR operation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment