DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

labs(S)


labs -- converts to absolute value

Syntax

cc . . . -lc

#include  <stdlib.h>

long labs (n) long n;

Description

The labs function produces the absolute value of its long-integer argument n.

Return value

The labs function returns the absolute value of its argument. There is no error return.

Example

   #include <stdlib.h>
   #include <stdio.h>
   

main() { long x,y;

x = -41567L; y = labs(x); printf("The labs (%ld) = %ld \n", x, y); }

This program uses labs to get and display the absolute value of -41,567.

See also

abs(S), fabs(S)

Standards conformance

labs is conformant with:

ANSI X3.159-1989 Programming Language -- C .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003