C++ ULLONG_MAX 宏常量
ULLONG_MAX 常量是 climits 頭中定義的宏常量,用於獲取 unsigned long long int 對象的最大值,返回 unsigned long long int 對象可以存儲的最大值,即 18446744073709551615(在 32位編譯器)。
注意:
- 實際值取決於編譯器架構或庫實現。
- 我們也可以使用
<limits.h>
頭文件而不是<climits>
兩個庫中都定義了作為 ULLONG_MAX 常量的頭文件。
ULLONG_MAX 常量的語法:
ULLONG_MAX
例:
Constant call:
cout << ULLONG_MAX;
Output:
18446744073709551615
用於演示帶有 climits 標頭的 ULLONG_MAX 常量示例的 C++ 代碼
// C++ code to demonstrate example of
// ULLONG_MAX constant with climits header
#include<iostream>
#include<climits>
using namespace std;
int main()
{
//prinitng the value of ULLONG_MAX
cout<<"ULLONG_MAX:"<<ULLONG_MAX<<endl;
return 0;
}
輸出
ULLONG_MAX:18446744073709551615
用limits.h頭文件演示ULLONG_MAX常量示例的C++代碼
// C++ code to demonstrate example of
// ULLONG_MAX constant with <limits.h> header file
#include<iostream>
#include<limits.h>
using namespace std;
int main()
{
//prinitng the value of ULLONG_MAX
cout<<"ULLONG_MAX:"<<ULLONG_MAX<<endl;
return 0;
}
輸出
ULLONG_MAX:18446744073709551615
相關用法
- C++ ULONG_MAX用法及代碼示例
- C++ UCHAR_MAX用法及代碼示例
- C++ UINT_MAX用法及代碼示例
- C++ USHRT_MAX用法及代碼示例
- C++ unordered_map cbegin用法及代碼示例
- C++ map lower_bound()用法及代碼示例
- C++ list assign()用法及代碼示例
- C++ std::max()用法及代碼示例
- C++ std::string::push_back()用法及代碼示例
- C++ multimap key_comp()用法及代碼示例
- C++ Deque erase()用法及代碼示例
- C++ std::less_equal用法及代碼示例
- C++ set rbegin()用法及代碼示例
- C++ llround()用法及代碼示例
- C++ getline(string)用法及代碼示例
- C++ boost::algorithm::all_of()用法及代碼示例
- C++ string::length()用法及代碼示例
- C++ log2()用法及代碼示例
- C++ lrint() and llrint()用法及代碼示例
- C++ bitset all()用法及代碼示例
注:本文由純淨天空篩選整理自 ULLONG_MAX constant with example in C++。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。