一个字节:00 00 00 00 = 8位二进制数
CPU为16位的机器:一个字=2个字节 16位为字长 2个字节组成一个字 字在计算机内负责传递信息
32位机器 一个字=4个字节 32位字长
int32: 4个字节储存
int64: 8个字节储存
int 类型 编译器会根据CPU字的长度编译
如16位CPU int就使用2个字节编译
一个字节由8位二进制数组成 一个字节有256种状态 就像一个英文字母有26种关态一样
00000000
为什么是256种:
0与1 为一个 二进制数 一个二进制数2种状态
2个二进制数 4种状态
00
01
10
11
3个二进制数呢?
00 0
01 0
00 1
01 1
10 0
10 1
11 0
11 1
其实就是2个进制数的状态X2
8个二进制数呢?
2^8=256种状态