C library function - labs()
Description
C Library Function long int labs(long int x) Return x the absolute value of
Declaration
Here is the declaration of the labs() function.
long int labs(long int x)
Parameters
- ** x ** -- the complete value.
Return Value
This function returns the absolute value of x.
Example
The following example demonstrates the use of the labs() function.
#include
#include
int main ()
{
long int a,b;
a = labs(65987L);
printf("a 的值 = %ld\n", a);
b = labs(-1005090L);
printf("b 的值 = %ld\n", b);
return(0);
}
Let's compile and run the above program, which will produce the following result:
a 的值 = 65987
b 的值 = 1005090
C Standard Library -