/* llabs example */
#include <stdio.h> /* printf */
#include <stdlib.h> /* llabs */
int main ()
{
longlongint n,m;
n=llabs(31558149LL);
m=llabs(-100000000LL);
printf ("n=%lld\n",n);
printf ("m=%lld\n",m);
return 0;
}
Output:
n=31558149
m=100000000
Data races
Concurrently calling this function is safe, causing no data races.
Exceptions (C++)
No-throw guarantee: this function throws no exceptions.
If the result cannot be represented as a long long int (such as llabs(LLONG_MIN) in an implementation with two's complement signed values), it causes undefined behavior.