Keil Logo Arm Logo

CARM User's Guide

Discontinued

abs

Summary
#include <math.h>
/* or */
#include <stdlib.h>

int abs (
  int val);     /* number to take absolute value of */
Description

The abs function determines the absolute value of the integer val.

Return Value

The abs function returns the absolute value of val.

See Also

fabs, labs

Example
#include <math.h>
#include <stdio.h> /* for printf */

void tst_abs (void) {
  int x;
  int y;

  x = -42;
  y = abs (x);

  printf ("ABS(%d) = %d\n", x, y);
}

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.