#include <stdlib.h> long int labs(long int j);
labs
returns the absolute value of a long int
.
labs
returns the absolute value of its argument. Both the result and the
argument are of long int
type.
labs
is implemented as a macro that invokes the built-in abs
function.
#include <stdio.h> #include <stdlib.h> main() { long int a, c; /* The variable, a, can have a negative value. */ int b; puts("Enter values for a (can be negative) and b:"); scanf("%ld %d", &a, &b); c = labs(a*b); /* Calculate absolute value. */ printf("The absolute value of their product = %ldn", c ); }
abs
, fabs
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.