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. Both comments and pings are currently closed. Tweet This! Tweet This! or use to share this post with others.

Comments are closed.