Skip to content

Instantly share code, notes, and snippets.

@scroobius-pip
Created March 28, 2017 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scroobius-pip/c0bc716bd72258be2a64ce47eaafbdc8 to your computer and use it in GitHub Desktop.
Save scroobius-pip/c0bc716bd72258be2a64ce47eaafbdc8 to your computer and use it in GitHub Desktop.
Swapping with only two variables
void s(int& a, int& b)
{
a = a ^ b;
b = a ^ b;
a = a ^ b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment