Skip to content

Instantly share code, notes, and snippets.

@UjwalManjunath
Last active December 17, 2015 13:08
Show Gist options
  • Save UjwalManjunath/5614400 to your computer and use it in GitHub Desktop.
Save UjwalManjunath/5614400 to your computer and use it in GitHub Desktop.
Swapping two variables without using temp.
void swap (int a, int b){
a = a+b; //9 = 4+5
b = a-b; //4 = 9-5
a = a-b; //5 = 9-4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment