Home »
C++ programming language
LLONG_MAX constant with example in C++
C++ LLONG_MAX constant: Here, we are going to learn about the LLONG_MAX macro constant of climits header in C++.
Submitted by IncludeHelp, on May 03, 2019
C++ LLONG_MAX macro constant
LLONG_MAX constant is a macro constant which is defied in climits header, it is used to get the maximum value of a long long int object, it returns the maximum value that a long long int object can store, which is 9223372036854775807 (on 32 bits compiler).
Note:
- The actual value depends on the compiler architecture or library implementation.
- We can also use <limits.h> header file instead of <climits> header as LLONG_MAX constant is defined in both of the libraries.
Syntax
Syntax of LLONG_MAX constant:
LLONG_MAX
Sample Input and Output
Constant call:
cout << LLONG_MAX;
Output:
9223372036854775807
Example 1
C++ code to demonstrate example of LLONG_MAX constant with climits header:
// C++ code to demonstrate example of
// LLONG_MAX constant with climits header
#include<iostream>
#include<climits>
using namespace std;
int main()
{
//prinitng the value of LLONG_MAX
cout<<"LLONG_MAX: "<<LLONG_MAX<<endl;
return 0;
}
Output
LLONG_MAX: 9223372036854775807
Example 2
C++ code to demonstrate example of LLONG_MAX constant with limits.h header file:
// C++ code to demonstrate example of
// LLONG_MAX constant with <limits.h> header file
#include<iostream>
#include<limits.h>
using namespace std;
int main()
{
//prinitng the value of LLONG_MAX
cout<<"LLONG_MAX: "<<LLONG_MAX<<endl;
return 0;
}
Output
LLONG_MAX: 9223372036854775807