当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
2022.8.8考试清洁工老马(sweeper)题解
.Net面试经验总结
首次在我们的centos登录我们的Mysql
LeetCode每日两题01:移动零 (均1200道)方法:双指针
Open3D 网格均匀采样
SQLserver加个判断
数据在内存中的存储
Linux(Centos7)服务器中配置Mysql主从数据库,以及数据库的安装,防火墙操作
数据库治理利器:动态读写分离
【SSRF漏洞】实战演示 超详细讲解
【二叉树-中等】1104. 二叉树寻路
【wpf】拖拽的简单实现
【每日一题】1413. 逐步求和得到正数的最小值
Open3D 泊松盘网格采样
实操|风控模型中常用的这三种预测方法与多分类场景的实现
2022.8.9考试排列变换--1200题解
C# winform 单选框
what is a microcontroller or mcu
51单片机驱动HMI串口屏,串口屏的下载方式
Open3D 中点细分(网格细分)









