abs

Returns the absolute value of its integer argument

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:Mathematical Computation

Syntax

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

Parameters

j
(IN) Specifies an integer argument.

Return Values

abs returns the absolute value of its integer argument.

Remarks

abs returns the absolute value of its integer argument j.

See Also

fabs, labs

Example

  #include <stdlib.h>  
  #include <stdio.h>  
   
  main ()  
  {  
     printf ("%d %d %d\n", abs (-5), abs (0), abs (5) );  
  }
  

produces the following:

  5   0   5