当前位置:网站首页>storage of data in memory
storage of data in memory
2022-08-10 03:19:00 【Cxz_learn_C】
1. There are three representation methods for integers in the computer, namely original code, inverse code and complement code
Unsigned integer, the original code of signed positive integer in memory, one's complement and one's complement are the same.
The original code, inverse code and complement code of signed negative integers in memory are different. The specific conversion methods are as follows:
Integers are stored in memory in two's complement, and they are also used in calculations.Reason: Two's complement can perform operations on the sign bit and subtraction.Here's an example:
2. Data is stored in memory at the big and small ends
Size-end storage is a storage method for data whose type size exceeds 1 byte. Note that if the data size is 1 byte, then the data inside the byteNo need to store in endianness.
Big-endian (storage) mode: means that the low-order bits of data are stored in the high address of the memory, and the high-order bits of the data are stored in the low address
of the memory.
Little-endian (storage) mode: means that the low-order bits of data are stored in the low address of the memory, and the high-order bits of the data are stored in the high address
of the memory.
The above two storage modes are for the storage of data whose data type is greater than 1 byte.Different compilers have different data storage modes. Currently I use little endian storage on vs2019.High bits raise the address, and status lowers the address.
3. The range of char type that can store data in memory
As shown:
For the convenience of readers' understanding, the following pictures are used for reference:
The same int type, the short type is also stored in this way.
边栏推荐
猜你喜欢
随机推荐
ECCV 2022 Oral | CCPL: 一种通用的关联性保留损失函数实现通用风格迁移
Database management tool: dynamic read-write separation
idea 删除文件空行
官宣出自己的博客了
51单片机驱动HMI串口屏,串口屏的下载方式
使用IDEA的PUSH常见问题
网络爬虫错误
2022 Top Net Cup Quals Reverse Partial writeup
volatile 关键字(修饰符 volatile 告诉编译器,变量的值可能以程序未明确指定的方式被改变)
实操|风控模型中常用的这三种预测方法与多分类场景的实现
Unity碰撞和触发
组件的使用
小程序开发的报价为什么有差别?需要多少钱?
2020.11.22考试哥德巴赫猜想题解
按钮倒计时提醒
宝塔服务器PHP+mysql网页URL跳转问题
OpenCV图像处理学习四,像素的读写操作和图像反差函数操作
空间复杂度为O(1)的归并排序
SQLserver加个判断
微透镜阵列的高级模拟