return the absolute value of an integer
#include <stdlib.h> int abs( int j );
The abs() function returns the absolute value of its integer argument j.
The absolute value of its argument.
#include <stdio.h> #include <stdlib.h> void main() { printf( "%d %d %d\n", abs (-5), abs (0), abs (5)); }
produces the following output:
5 0 5
ANSI
Safety: | |
---|---|
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |