labs
return the absolute value of a long integer
You're viewing an older version of this page (#3472). View the current version.
INTERFACE
#include <stdlib.h>
long labs ( long j )
DESCRIPTION
The labs function returns the absolute value of the long integer j, denoted by and defined through:
(1)
Example 1
#include <stdio.h>
#include <stdlib.h>
int main()
{
long int a = -231564565;
printf("|a| = %ld\n", labs(a));
return 0;
}Output:
|a| = 231564565SEE ALSO
BUGS
The absolute value of the most negative integer remains negative.