C++ INT_MIN 宏常量
INT_MIN 常量是在 climits 头文件中定义的宏常量,用于获取有符号 int 对象的最小值,它返回有符号 int 对象可以存储的最小值,即 -2147483648(在 32 位编译器上) .
注意:
- 实际值取决于编译器架构或库实现。
- 我们也可以使用
<limits.h>
头文件而不是<climits>
两个库中都定义了作为 INT_MIN 常量的头文件。
INT_MIN 常量的语法:
INT_MIN
例:
Constant call:
cout << INT_MIN;
Output:
-2147483648
用于演示带有 climits 标头的 INT_MIN 常量示例的 C++ 代码
// C++ code to demonstrate example of
// INT_MIN constant with climits header
#include<iostream>
#include<climits>
using namespace std;
int main()
{
//prinitng the value of INT_MIN
cout<<"INT_MIN:"<<INT_MIN<<endl;
return 0;
}
输出
INT_MIN:-2147483648
用limits.h头文件演示INT_MIN常量示例的C++代码
// C++ code to demonstrate example of
// INT_MIN constant with <limits.h> header file
#include<iostream>
#include<limits.h>
using namespace std;
int main()
{
//prinitng the value of INT_MIN
cout<<"INT_MIN:"<<INT_MIN<<endl;
return 0;
}
输出
INT_MIN:-2147483648
相关用法
- C++ INT_MAX用法及代码示例
- C++内联函数用法及代码示例
- C++ Implementing of strtok()用法及代码示例
- 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()用法及代码示例
- C++ set upper_bound()用法及代码示例
注:本文由纯净天空筛选整理自 INT_MIN constant with example in C++。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。