[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
abs() Calculate Absolute Value of Integer
#include <stdlib.h> For function declarations
int abs(n);
int n; Integer value
abs() returns the absolute value of the integer 'n'.
Returns: The absolute value of 'n'.
-------------------------------- Example ---------------------------------
The following statements calculate the absolute values of -15, 0 and
33.
#include <math.h> /* Required for function declaration only */
main()
{
int x, y, z;
x = abs(-15); /* x = 15 */
y = abs(0); /* y = 0 */
z = abs(33); /* z = 33 */
}
See Also:
cabs()
fabs()
labs()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson