Skip to main content

Pointer -hackerrank (challenges writeup)

Pointer -hackerrank (challenges writeup)
 Pointer
https://www.hackerrank.com/challenges/c-tutorial-pointer/problem


#include<iostream>
using namespace std;
void func(int *z,int *f)
{
   int aa = *z;
   *z = *z + *f;
   *f = aa- *f;
      if(*f < 0)*f *= -1;

  

}

int main()

{

    int a, b;
    int *pa = &a, *pb = &b;
    cin >> a>> b;
    func(pa,pb);
    cout <<a<<endl;
    cout<< b;

}