abs function(Absolute Value of Integer) in C Language – example and detail

In the C Programming Language, the abs characteristic returns the absolute value of an integer.

Syntax

The syntax for the abs function in the C Language is:

int abs(int x);

Parameters or Arguments

x

A value to convert to an absolute value.

Returns

The abs characteristic returns the absolute price of an integer represented by using x.

Required Header

In the C Language, the required header for the abs characteristic is:

#include <stdlib.h>

Applies To

In the C Language, the abs feature can be used in the following versions:

ANSI/ISO 9899-1990

Similar Functions

Other C functions that are comparable to the abs function:

fabs function <math.h>

labs function <stdlib.h>