当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
【二叉树-中等】687. 最长同值路径
数据在内存中的存储
LeetCode每日两题01:移动零 (均1200道)方法:双指针
2022.8.8考试摄像师老马(photographer)题解
2022 Top Net Cup Quals Reverse Partial writeup
微生物是如何影响身体健康的
具有多孔光纤的偏振分束器
华为HCIE云计算之FC添加ipsan数据存储
Pagoda server PHP+mysql web page URL jump problem
MySQL:日志系统介绍 | 错误日志 | 查询日志 | 二进制日志:bin-log数据恢复实践 | 慢日志查询
SQLserver加个判断
首次在我们的centos上安装MySQL
2022.8.9考试独特的投标拍卖--800题解
one of the variables needed for gradient computation has been modified by an inplace
c# 解决CS8602告警 解引用可能出现空引用
【wpf】拖拽的简单实现
[网鼎杯 2020 青龙组]AreUSerialz
【论文粗读】(NeurIPS 2020) SwAV:对比聚类结果的无监督视觉特征学习
用于X射线光学器件的哈特曼波前传感器
基于C51的中断控制