Skip to content

Instantly share code, notes, and snippets.

@y-yu
Created November 20, 2012 11:17
Show Gist options
  • Save y-yu/4117351 to your computer and use it in GitHub Desktop.
Save y-yu/4117351 to your computer and use it in GitHub Desktop.
7-1
#include <stdio.h>
void plus_minus (int *a, int *b) {
int a_ori = *a,
b_ori = *b;
*a = a_ori + b_ori;
*b = a_ori - b_ori;
}
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