内存地址笔记

来源:互联网 发布:百度知道 知乎 编辑:程序博客网 时间:2024/06/06 18:57

The smallest unit ofmemory is a binary digit (bit), which can hold a value of 0 or 1. You can thinkof 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 randomsegment of memory, all you would see is …011010100101010… or some combinationthereof. Memory is organized into sequential units called addresses. Similar to how a streetaddress can be used to find a given house on a street, the memory addressallows us to find and access the contents of memory at a particular location.Perhaps surprisingly, in modern computers, each bit does not get its ownaddress. The smallest addressable unit of memory is a group of 8 bits known asa byte.

The following pictureshows some sequential memory addresses, along with the corresponding byte ofdata:


Because all data on acomputer is just a sequence of bits, we use a data type to tell us how to interpret thecontents of memory in some meaningful way. You have already seen one example ofa data type: the integer. When we declare a variable as an integer, we aretelling the compiler “the piece of memory that this variable addresses is goingto be interpreted as a whole number”.

32位计算机:address寻址大小 最大4G 2^32  0x00000000----0xffffffff   0x100000000 即2^32  16^8这么多的字节 0b1100 1010              0xca  







0 0
原创粉丝点击