Labs () function in C
Function long int labs (long int x) returns the absolute value of x.
Labs () function in C
Function long int labs (long int x) returns the absolute value of x.
Declare labs () function in C
Below is the declaration for labs () in C:
long int labs ( long int x )
Parameters
x: an integer value.
Returns the value
This function returns the absolute value of x.
For example
The following C program illustrates the usage of labs () in C:
#include #include int main () { long int a , b ; a = labs ( 65987L ); printf ( "Gia tri cua a = %ldn" , a ); b = labs (- 1005090L ); printf ( "Gia tri cua b = %ldn" , b ); return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous lesson: Div () function in C
Next lesson: The function ldiv () in C
Update 25 May 2019
You should read it
- Call the function by pointer in C ++
- Function realloc () in C
- Malloc () function in C
- Function abs () in C
- The function getenv () in C
- The function rand () in C
- The abort () function in C
- Pass cursor to function in C ++
- Div () function in C
- Cursor this in C ++
- The function ldiv () in C
- The qsort () function in C
Maybe you are interested
Unbelievable coincidence in history makes the whole world astounded How to directly see the phenomenon of super moon, blue moon and eclipse converging after more than 150 years The most anticipated astronomical events of 2017 How terrible is the rocket that will bring people to Mars? Learn about extraterrestrial super-Earth - Gliese 581c New discovery of life on planet GJ 1132b, 'Super Earth' is 39 light-years away