calculate the absolute value of a long integer
#include <stdlib.h> long int labs( long int j );
The labs() function returns the absolute value of its long-integer argument j.
The absolute value.
#include <stdio.h>
#include <stdlib.h>
void main()
{
long x, y;
x = -50000L;
y = labs( x );
printf( "labs(%ld) = %ld\n", x, y );
}
produces the output:
labs(-50000) = 50000
ANSI
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |