C Programming/math.h/labs

In C language the function labs is included in header file stdlib.h. The abs() function computes and returns the absolute value of the integer argument i. The labs() function computes and returns the absolute value of the long integer argument, of the appropriate long integer type for the function. The llabs() function computes and returns the absolute value of long long integer argument.

Description edit

The labs() is a library function. It is used under #include<stdlib.h> header file. This function computes the absolute value of the long integer argument i. It also returns the absolute value of the argument. That is, if i is negative, the result is opposite of i, but if i is non-negative the result is i.

Required header files edit

  1. include<stdio.h>
  2. include<stdlib.h>

Syntax edit

  1. include<stdlib.h>

long int labs(long int i);


References edit

http://cplusplus.com/reference/clibrary/cstdlib/labs/
http://linux.die.net/man/3/labs