DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

labs(S-osr5)


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-osr5), fabs(S-osr5)

Standards conformance

labs is conformant with:

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


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005