You are viewing a single comment's thread. Return to all comments →
void update(int *a, int *b) { int sum = *a + *b; int diff = abs(*a - *b); *a = sum; *b = diff; }
int main() { int a, b; scanf("%d %d", &a, &b); update(&a, &b); printf("%d\n%d\n", a, b);
return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Pointers in C
You are viewing a single comment's thread. Return to all comments →
include
include
void update(int *a, int *b) { int sum = *a + *b;
int diff = abs(*a - *b); *a = sum;
*b = diff; }
int main() { int a, b; scanf("%d %d", &a, &b); update(&a, &b); printf("%d\n%d\n", a, b);
}