Input Format
The 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.
Note: Input/ouput will be automatically handled. You only have to complete the function described in the 'task' section.

hackerrank pointers in c programming problem solution

Pointers in C problem solution | 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;