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 */
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster