#include <stdio.h>
#include <cmath>
void update(int *a,int *b) {
    // Complete this function 
    (*a) = abs(*a + *b);
    (*b) = abs(*a - *b);   
}
int main() {
    int a, b;
    int *pa = &a, *pb = &b;
    scanf("%d %d", &a, &b);
    update(pa, pb);
    printf("%d\n%d", a, b);
    return 0;
}
I have the code below (from HackerRank C++ challenges). 
If I enter 4 and 5, it will return 9 and 4 as output instead of 9 and 1. 
I assumed it would be 4 - 5 = abs(-1) = 1. 
Why doesn't it operate that way?