 | Cx51 User's Guide |  |
|
|
| abs| Summary |
#include <math.h>
/* or */
#include <stdlib.h>
int abs (
int val); /* number to take absolute value of */
| | Description | The abs function determines the absolute value of the integer val. | | Return Value | The abs function returns the absolute value of val. | | See Also | cabs, fabs, labs | | Example |
#include <math.h>
#include <stdio.h> /* for printf */
void tst_abs (void) {
int x;
int y;
x = -42;
y = abs (x);
printf ("ABS(%d) = %d\n", x, y);
}
|
|
|