Abs >> Math.h Function >>
Syntax 1 [Return Double] :

double abs(complex x);
Syntax 2 [Return Integer] :
int abs(int x);
  1. abs is not a function , it is macro
  2. This Macro gives the absolute value of an integer.
  3. If abs is called when STDLIB.H has been included, it is treated as a macro that expands to inline code.
  4. 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>
#include< math.h>
int main(void)
{
  int number = -1234;
  printf("number: %d  absolute value: %d\n", number, abs(number));
  return 0;
}
Output :
number : -1234  absolute value : 1234


Tags / Keywords : | ,

0 comments

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email