title: How to fix "error: call to 'abs' is ambiguous"
body: <p>I'm running a simple C++ program from HackerRank about pointers and it works fine on the website. However,
  when I run it on MacOS, I get <code>error: call to 'abs' is ambiguous</code> and I'm not sure exactly what is ambiguous.</p>
  
  <p>I've looked at other answers to similar issues,  but the error message tends to be <code>Ambiguous overload call to abs(double)</code>, which is not the issue I'm having, since I haven't used any doubles. I've also tried including the header files <code>cmath</code> and <code>math.h</code>, but the problem persists.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;cmath&gt;
  
  void update(int *a,int *b) {
      int num1 = *a;
      int num2 = *b;
      *a = num1 + num2;
      *b = abs(num1 - num2);
  }
  
  int main() {
      int a, b;
      int *pa = &amp;a, *pb = &amp;b;
  
      scanf("%d %d", &amp;a, &amp;b);
      update(pa, pb);
      printf("%d\n%d", a, b);
  
      return 0;
  }
  </code></pre>
  
  <p>My issue occurs with line 8.</p>