C programming stdlib.h function - int abs(int x)

https://w‮‬ww.theitroad.com

The abs() function is declared in the stdlib.h header file in C programming language. It takes an integer argument and returns its absolute value as an integer. The prototype of the abs() function is as follows:

int abs(int x);

The abs() function is used to return the absolute value of an integer. The absolute value of a number is its value without regard to its sign, so the absolute value of a positive number is the same as the number, while the absolute value of a negative number is the opposite of the number.

For example, the absolute value of -5 is 5, and the absolute value of 5 is also 5.

The abs() function can be useful in situations where you need to get the magnitude of a number without regard to its sign.