Open In App

Maximum value of long long int in C++

In this article, we will discuss the long long int data type in C++. long long int data type in C++ is used to store 64-bit integers. It is one of the largest data types to store integer values, unlike unsigned long long int both positive and negative.

Some properties of the long long int data type are:



Below is the program to get the highest value that can be stored in long long int in C++:




// C++ program to illustrate the maximum
// value that can be stored in long long int
#include <climits>
#include <iostream>
using namespace std;
 
// Driver Code
int main()
{
    // From the constant of climits
    // header file
    long long int valueFromLimits = LLONG_MAX;
    cout << "Value from climits "
         << "constant (maximum): ";
    cout << valueFromLimits
         << "\n";
 
    valueFromLimits = LLONG_MIN;
    cout << "Value from climits "
         << "constant (minimum): ";
    cout << valueFromLimits
         << "\n";
 
    return 0;
}

Output:

Value from climits constant (maximum): 9223372036854775807
Value from climits constant (minimum): -9223372036854775808

Time Complexity: O(1)
Auxiliary Space: O(1)

Article Tags :