[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
labs() Calculate Absolute Value of Long Integer
#include <stdlib.h> Required for declarations only
long labs(n);
long n; Long integer value
labs() returns the absolute value of the long integer 'n'.
Returns: The absolute value of 'n'. There is no error return.
-------------------------------- Example ---------------------------------
The following statements calculate the absolute values of -150000L,
0L, and 33333L.
#include <stdlib.h> /* Required for declaration only */
main()
{
long x, y, z;
x = labs(-150000L); /* x = 150000L */
y = labs(0L); /* y = 0L */
z = labs(33333L); /* z = 33333L */
}
See Also:
abs()
cabs()
fabs()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson