abs

return the absolute value of an integer

Synopsis:

#include <stdlib.h>
int abs( int j );

Description:

The abs() function returns the absolute value of its integer argument j.

Returns:

the absolute value of its argument

See also:

fabs(), labs()

Examples:

#include <stdio.h>
#include <stdlib.h>

void main()
  {
    printf( "%d %d %d\n", abs (-5), abs (0),
      abs (5));
  }

produces the following output:

5 0 5

Classification:

ANSI

Systems:

All (except DOS/PM)