Created
November 20, 2012 11:17
-
-
Save y-yu/4117351 to your computer and use it in GitHub Desktop.
7-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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