C programming stdlib.h function - long int labs(long int x)

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

The labs() function is declared in the stdlib.h header file in C programming language. It takes a long integer argument x and returns its absolute value as a long integer.

The prototype of the labs() function is as follows:

long int labs(long int x);

The labs() function is used to return the absolute value of a long 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 labs() function can be useful in situations where you need to get the magnitude of a long integer without regard to its sign.