Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

abs() function in C++ | What is abs() function?

What is abs() Function?

      The abs() function is used to find the absolute value of an integer value. The absolute value is a having no sign. The declaration of abs() function is as follows:
int abs (int);
      The declaration of abs() function indicates that an integer parameter is passed to this function. The output returned by this function is also of "int" type.
      The general syntax to call this function is given below:-
var = abs (x);
In the above syntax:

x

It indicates an integer variable, integer constant value or expression whose absolute value is to be found. For example, if value of x is -44, then this function will return 44.

var

It indicates the variable of "int" type into which the returned absolute value is to be assigned.


This post first appeared on Programming Explain, please read the originial post: here

Share the post

abs() function in C++ | What is abs() function?

×

Subscribe to Programming Explain

Get updates delivered right to your inbox!

Thank you for your subscription

×