Syntax
#include <stdlib.h> long int labs(long int n);Description
labs produces the absolute value of its long integer argument n. The result may be undefined when the argument is equal to LONG_MIN, the smallest available long integer (-2 147 483 647). The value LONG_MIN is defined in the <limits.h> include file.
labs returns the absolute value of n. There is no error return value.
This example computes y as the absolute value of the long integer -41567.
#include <stdlib.h>
int main(void)
{
   long x,y;
   x = -41567L;
   y = labs(x);
   printf("The absolute value of %ld is %ld\n", x, y);
   return 0;
   /****************************************************************************
      The output should be:
      The absolute value of -41567 is 41567
   ****************************************************************************/
}
Related Information