
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>labs() calculate absolute value of long integer</b>
[<<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'.
-------------------------------- 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()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson