C++常见数据类型大小

uint
ulong 无符号长整形

Type Min Max CLS-compliant
int -2,147,483,648 2,147,483,647 Yes
uint 0 4,294,967,295 No
long –9,223,372,036,854,775,808 9,223,372,036,854,775,807 Yes
ulong 0 18,446,744,073,709,551,615 No

要在源代码中写入一个文字无符号整数,你可以使用后缀u或U例如123U。
如果你希望符合CLS标准,则不应在你的公共界面中使用uint和ulong 。

INT
UINT
long
ulong

=================================================
0xffff 转换成二进制 一个f代表15 转换成二进制是 1111
4个f,所以是1111 1111 1111 1111
2^16 = 65535
在这里插入图片描述

LONG_MIN constant:a macro constant which is defined in climits header.It is used to get the minimum value of a long int object, it returns the minimum value that a long int object can store, which is -9223372036854775808 (on 32 bits compiler).

LONG_MIN常量是在climits标头中定义的宏常量,用于获取long int对象的最小值,它返回long int对象可以存储的最小值,即-9223372036854775808 (在32位编译器上) 。

Note:

注意:

The actual value depends on the compiler architecture or library implementation.

实际值取决于编译器体系结构或库实现。

We can also use <limits.h> header file instead of header as LONG_MIN constant is defined in both of the libraries.

我们也可以使用<limits.h>头文件代替头文件,因为在两个库中都定义了LONG_MIN常量 。

// C++ code to demonstrate example of
// LONG_MIN constant with climits header
#include
#include
using namespace std;

int main()
{
//prinitng the value of LONG_MIN
cout<<"LONG_MIN: "<<LONG_MIN<<endl;
return 0;
}

我的机子跑出来是

LONG_MIN: -2147483648

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值