LABS(S) UNIX System V LABS(S)
Name
labs - converts to absolute value
Syntax
#include <stdlib.h>
long labs(n)
long n;
Description
The labs function produces the absolute value of its long-
integer argument n.
Return Value
The labs function returns the absolute value of its
argument. There is no error return.
See Also
abs(S), fabs(S)
Example
#include <stdlib.h>
#include <stdio.h>
main()
{
long x,y;
x = -41567L;
y = labs(x);
printf("The labs(%ld) = %ld \n",x,y);
}
This program uses labs to get and display the absolute value
of -41,567.
Standards Conformance
labs is conformant with:
ANSI X3.159-198X C Language Draft Standard, May 13, 1988.
(printed 6/20/89)