Abs(x) >> Absolute Value >> Math.h FunctionPritesh
Abs >> Math.h Function >>
Syntax 1 [Return Double] :
double abs(complex x);
Syntax 2 [Return Integer] :int abs(int x);
- abs is not a function , it is macro.
- This Macro gives the absolute value of an integer.
- If abs is called when STDLIB.H has been included, it is treated as a macro that expands to inline code.
- If you want to use the abs function instead of the macro, include #undef abs in your program, after the #include <STDLIB.H>.
Live Example :#include<stdio.h>
int number = -1234;
printf("number: %d absolute value: %dn", number, abs(number));
Output :number : -1234 absolute value : 1234