labs
long  labs ( long n );
math.h
stdlib.h
  cplusplus.com  

Return absolute value of long integer parameter.
  The absolute value corresponding to the long int parameter n is returned ( /n/ ).

Parameters.

n
Integer value.

Return Value.
  The absolute value of n.

Portability.
  Defined in ANSI-C.

Example.

/* labs example */
#include <stdio.h>
#include <math.h>

main ()
{
  int n,m;
  n=labs(65537);
  m=labs(-100000);
  printf ("n=%d\n",n);
  printf ("m=%d\n",m);
  return 0;
}
Output:
 n=65537
 m=100000

See also.
  abs, fabs


© The C++ Resources Network, 2000