C Reference function abs()
This function of stdlib will return the absolute value of an integer.
Usage of abs():
int abs ( int x );
Parameters:
An integer x.
Return value:
The absolute value of integer x.
Source code example of abs():
#include<stdio.h>
#include<stdlib.h>
int main ()
{
int x;
x=abs(-17);
printf ("x=%d\n",x);
return 0;
}
Output of the abs example program above:
x=17
This entry was posted in C Reference stdlib.h Functions.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Tweet This! or use
to share this post with others.