long int labs (long int n);
/n/ ).long int version of abs .1
2
3
4
5
6
7
8
9
10
11
12
13
/* labs example */
#include <stdio.h> /* printf */
#include <stdlib.h> /* labs */
int main ()
{
long int n,m;
n=labs(65537L);
m=labs(-100000L);
printf ("n=%ld\n",n);
printf ("m=%ld\n",m);
return 0;
}
n=65537 m=100000
long int (such as labs(LONG_MIN) in an implementation with two's complement signed values), it causes undefined behavior.