abs, labs, llabs, imaxabs − compute the absolute value of an integer
#include <stdlib.h>
int
abs(int j);
long int labs(long int j);
long long int llabs(long long int j);
#include <inttypes.h>
intmax_t imaxabs(intmax_t j);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
llabs():
_XOPEN_SOURCE >= 600
|| _ISOC99_SOURCE ||
_POSIX_C_SOURCE >= 200112L;
or cc -std=c99
The abs() function computes the absolute value of the integer argument j. The labs(), llabs() and imaxabs() functions compute the absolute value of the argument j of the appropriate integer type for the function.
Returns the absolute value of the integer argument, of the appropriate integer type for the function.
For an explanation of the terms used in this section, see attributes(7).