内存地址笔记

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  







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值