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 of its argument
#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
All (except DOS/PM)