C Reference function labs()

This function will return the absolute value of a long integer.

Usage of labs():

long int labs (long int n);

Parameters:

An integer n.

Return value:


Returns the absolute value of parameter n.

Source code example of labs():


	#include<stdio.h>
	#include<stdlib.h>

	int main ()
	{
		long int n,m;

		n=labs(55L);
		m=labs(-200L);

		printf ("n=%ld\n",n);
		printf ("m=%ld\n",m);

		return 0;
	}

Output of the labs example program above:


	n=55
	m=100

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! Tweet This! or use to share this post with others.

Leave a Reply: