Input Format
Input will contain two integers,  and , separated by a newline.
Output Format
You have to print the updated value of  and , on two different lines.

hackerrank pointer problem solution in c++ programming

Pointe problem solution in C++ programming | HackerRank

#include <cstdio>
#include <cstdlib>

void update(int *a,int *b) {
    int temp = *a;
    *a = *a + *b;
    *b = abs(temp - *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;