[Previous]
[Contents]
[Next]

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.

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

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

fabs(), labs()


[Previous]
[Contents]
[Next]