abs(3)
Name
abs, labs − integer absolute value
Syntax
#include <stdlib.h>
#include <stdlib.h>
long labs(i)
long i;
int abs(i)
int i;
long labs(i)
long i;
Description
The abs and labs functions return the absolute value of their integer operand. The labs function does the same for a long int.
Restrictions
Applying the abs or labs function to the most negative integer generates a result which is the most negative integer. That is,
abs(0x80000000)
returns 0x80000000 as a result.