寻址存储器
2015-12-01 15:59
323 查看
寻址存储器
This lesson builds directly on the material in the section “1.3 -- A first look at variables“.
这一课直接在“1.3 -第一看变量”部分的材料上。
In the previous lesson on variables, we talked about the fact that variables are names for a piece of memory that can be used to store information. To recap briefly, computers have random access memory
(RAM) that is available for programs to use. When a variable is defined, a piece of that memory is set aside for that variable.
在上一节课上,我们谈到了一个事实,即变量是一段记忆的名字,可以用来存储信息。简要概括起来,计算机的随机存取存储器(RAM),可供程序使用。当一个变量被定义时,一块内存被放置到该变量的旁边。
The smallest unit of memory is a binary digit (bit), which can hold a value of 0 or 1. You can think of a bit as being like a traditional light switch -- either the light is off (0), or it is on (1).
There is no in-between. If you were to look at a random segment of memory, all you would see is …011010100101010… or some combination thereof. Memory is organized into sequential units called addresses. Similar to how a street address can be used to find a
given house on a street, the memory address allows us to find and access the contents of memory at a particular location. Perhaps surprisingly, in modern computers, each bit does not get its own address. The smallest addressable unit of memory is a group of
8 bits known as a byte.
最小单位的内存是一个二进制数字(位),它可以容纳一个值为1或0。你能想到的有点像一个传统的光开关-无论是光是关闭(0),或它是在(1)。没有在之间。如果你想看一段随机的记忆,你会看到的是……011010100101010……或者是一些组合。内存被组织成顺序的单位称为地址。类似于街道地址可以用来在街道上找到一个给定的房子,内存地址让我们找到和访问的内容,在一个特定的位置。也许令人惊讶的是,在现代的计算机中,每一位都没有得到它自己的地址。最小的可寻址存储器单元是一组称为字节的8位。
因为计算机上的所有数据只是一个位序列,我们使用数据类型来告诉我们一些有意义的方式来解释内存的内容。你已经看到了数据类型的一个例子:整数。当我们将一个变量作为一个整型变量时,我们告诉编译器:这个变量的地址将被解释为一个整数,这是一个整型变量。
When you assign a value to a data type, the compiler and CPU take care of the details of encoding your value into the appropriate sequence of bits for that data type. When you ask for your value back,
your number is “reconstituted” from the sequence of bits in memory.
当你将一个值赋给一个数据类型时,编译器和处理器会把你的值编码为该数据类型的适当的位序列的细节。当你要求你的价值回归,你的数字是“重组”从内存中的位序列。
There are many other data types in C++ besides the integer, most of which we will cover shortly. As shorthand, we typically refer to a variable’s “data type” as its “type”.
有许多其他的数据类型,在+ +除了整数,其中大部分我们将很快覆盖。作为速记,我们通常将变量的“数据类型”称为“类型”。
Fundamental data types
基本数据类型
C++ comes with built-in support for certain data types. These are called fundamental data types (in the C++ specification), but are often informally called basic types, primitive types, or built-in
types.
带有内置支持某些数据类型。这些被称为基本数据类型(在C++规范),但通常被称为基本类型,原始类型,或内置类型。
Here is a list of the fundamental data types, some of which you have already seen:
下面是一个基本数据类型的列表,其中一些你已经看到:
1
2
3
4
5
bool bValue;
char chValue;
int nValue;
float fValue;
double dValue;
This lesson builds directly on the material in the section “1.3 -- A first look at variables“.
这一课直接在“1.3 -第一看变量”部分的材料上。
In the previous lesson on variables, we talked about the fact that variables are names for a piece of memory that can be used to store information. To recap briefly, computers have random access memory
(RAM) that is available for programs to use. When a variable is defined, a piece of that memory is set aside for that variable.
在上一节课上,我们谈到了一个事实,即变量是一段记忆的名字,可以用来存储信息。简要概括起来,计算机的随机存取存储器(RAM),可供程序使用。当一个变量被定义时,一块内存被放置到该变量的旁边。
The smallest unit of memory is a binary digit (bit), which can hold a value of 0 or 1. You can think of a bit as being like a traditional light switch -- either the light is off (0), or it is on (1).
There is no in-between. If you were to look at a random segment of memory, all you would see is …011010100101010… or some combination thereof. Memory is organized into sequential units called addresses. Similar to how a street address can be used to find a
given house on a street, the memory address allows us to find and access the contents of memory at a particular location. Perhaps surprisingly, in modern computers, each bit does not get its own address. The smallest addressable unit of memory is a group of
8 bits known as a byte.
最小单位的内存是一个二进制数字(位),它可以容纳一个值为1或0。你能想到的有点像一个传统的光开关-无论是光是关闭(0),或它是在(1)。没有在之间。如果你想看一段随机的记忆,你会看到的是……011010100101010……或者是一些组合。内存被组织成顺序的单位称为地址。类似于街道地址可以用来在街道上找到一个给定的房子,内存地址让我们找到和访问的内容,在一个特定的位置。也许令人惊讶的是,在现代的计算机中,每一位都没有得到它自己的地址。最小的可寻址存储器单元是一组称为字节的8位。
因为计算机上的所有数据只是一个位序列,我们使用数据类型来告诉我们一些有意义的方式来解释内存的内容。你已经看到了数据类型的一个例子:整数。当我们将一个变量作为一个整型变量时,我们告诉编译器:这个变量的地址将被解释为一个整数,这是一个整型变量。
When you assign a value to a data type, the compiler and CPU take care of the details of encoding your value into the appropriate sequence of bits for that data type. When you ask for your value back,
your number is “reconstituted” from the sequence of bits in memory.
当你将一个值赋给一个数据类型时,编译器和处理器会把你的值编码为该数据类型的适当的位序列的细节。当你要求你的价值回归,你的数字是“重组”从内存中的位序列。
There are many other data types in C++ besides the integer, most of which we will cover shortly. As shorthand, we typically refer to a variable’s “data type” as its “type”.
有许多其他的数据类型,在+ +除了整数,其中大部分我们将很快覆盖。作为速记,我们通常将变量的“数据类型”称为“类型”。
Fundamental data types
基本数据类型
C++ comes with built-in support for certain data types. These are called fundamental data types (in the C++ specification), but are often informally called basic types, primitive types, or built-in
types.
带有内置支持某些数据类型。这些被称为基本数据类型(在C++规范),但通常被称为基本类型,原始类型,或内置类型。
Here is a list of the fundamental data types, some of which you have already seen:
下面是一个基本数据类型的列表,其中一些你已经看到:
1
2
3
4
5
bool bValue;
char chValue;
int nValue;
float fValue;
double dValue;
相关文章推荐
- 寻址存储器
- 图像分割—基于图的图像分割(Graph-BasedImageSegmentation)
- solr4.10 配置相似查询 MoreLikeThisComponent(MLT)和 MoreLikeThisHandler
- java常用工具类!
- 滚动面板 我的java学习之路 ,滚动面板,多线程
- 一. Spring框架防XXS跨站攻击
- Timer中schedule()的用法
- 修改 Ubuntu 13.04 LAMP 服务器端口号
- nginx日志分析利器GoAccess
- iOS开发--UIWebview与H5之间的交互
- Linux 软连接和硬连接(转)
- MFC中List box的用法
- express 错误处理
- ASP.NET MVC 基于强类型视图下 对模型以及模型中List 字段的同时编辑 表单提交
- 【读书笔记】统计学:从数据到结论 第五章
- JAVA 遛一遛
- Selective Search for Object Recognition
- Unity3d 5.0破解步骤
- 学Android---DatePicker&TimePicker
- 用pb打开i图片