long和int数据类型之间的区别 [英] Difference between long and int data types

查看:246
本文介绍了long和int数据类型之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到以下语句返回 4 int long C ++中的类型?

Considering that the following statements return 4, what is the difference between the int and long types in C++?

sizeof(int)
sizeof(long)


推荐答案

this reference:

From this reference:


一个int原本是为
自然字大小的
处理器。许多现代处理器可以
处理不同的字大小,等于
ease。

An int was originally intended to be the "natural" word size of the processor. Many modern processors can handle different word sizes with equal ease.

p>

Also, this bit:


在许多(但不是全部)C和C ++
实现上,long大于
和int。今天最流行的桌面
平台,如Windows和Linux,
主要运行在32位处理器和
这些平台上的大多数编译器使用
a 32位int具有相同的大小
和表示为长。

On many (but not all) C and C++ implementations, a long is larger than an int. Today's most popular desktop platforms, such as Windows and Linux, run primarily on 32 bit processors and most compilers for these platforms use a 32 bit int which has the same size and representation as a long.

这篇关于long和int数据类型之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆