Skip to content

Instantly share code, notes, and snippets.

@y-yu
Created January 13, 2013 13:41
Show Gist options
  • Save y-yu/4524171 to your computer and use it in GitHub Desktop.
Save y-yu/4524171 to your computer and use it in GitHub Desktop.
#include <stdio.h>
void plus_minus(int *a, int *b)
{
int t1 = *a,
t2 = *b;
*a = t1 + t2;
*b = t1 - t2;
}
int main()
{
int a = 1, b = 2;
plus_minus(&a, &b);
printf("%d %d\n",a,b);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment