Skip to content

Instantly share code, notes, and snippets.

@UjwalManjunath
Created May 20, 2013 18:57
Show Gist options
  • Save UjwalManjunath/5614585 to your computer and use it in GitHub Desktop.
Save UjwalManjunath/5614585 to your computer and use it in GitHub Desktop.
Swapping two variables without using temp variable
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