长整数的表示 [英] Representation of Long Integers
本文介绍了长整数的表示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include <iostream>
int main()
{
std::cout << sizeof(int) << std::endl;
std::cout << sizeof(long int) << std::endl;
}
输出:
4
4
这是怎么可能的?不应 long int
在大小上大于 int
?
How is this possible? Shouldn't long int
be bigger in size than int
?
推荐答案
您的保证是:
sizeof(int) <= sizeof(long)
sizeof(int) * CHAR_BITS >= 16
sizeof(long) * CHAR_BITS >= 32
CHAR_BITS >= 8
所有这些条件都满足:
sizeof(int) == 4
sizeof(long) == 4
这篇关于长整数的表示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文