![]() |
![]() |
![]() |
C++ Reference: abs()
abs()
Declaration
int abs(int);
Description
Returns the absolute value of an int.
Related Functions *
long labs(long lNumber);
* Note: Since C does not allow function overloading, these other versions of this function exist.
Example
#include <iostream>
#include <cstdlib>
int main() {
using namespace std;
cout << abs(17) << endl;
cout << abs(-17) << endl;
return 0;
}
Output:
![]() |
![]() |
![]() |
| Home | | | Reference | | | Play Games! | | | Blog | | | Forum | | | Site Map | | | Contact Us |





