Skip to content

Instantly share code, notes, and snippets.

@sdvcrx
Created August 6, 2013 12:44
Show Gist options
  • Save sdvcrx/6164132 to your computer and use it in GitHub Desktop.
Save sdvcrx/6164132 to your computer and use it in GitHub Desktop.
无中间变量交换两值
void inplace_swap(int *x, int *y)
{
*y = *x ^ *y;
*x = *x ^ *y;
*y = *x ^ *y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment