Skip to content

Instantly share code, notes, and snippets.

@timothyandrew
Created April 16, 2013 07:02
Show Gist options
  • Save timothyandrew/5393934 to your computer and use it in GitHub Desktop.
Save timothyandrew/5393934 to your computer and use it in GitHub Desktop.
void swap(int a, int b, int* ref1, int* ref2) {
*ref2 = a;
*ref1 = b;
}
int main() {
int a = 5, b = 10;
swap(a, b, &a, &b);
printf("%d\n%d\n", a,b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment