当前位置:网站首页>栈的生长方向和内存生长方向
栈的生长方向和内存生长方向
2022-06-21 16:03:00 【打酱油的;】
1.栈的生长方向
栈从高至低方向生长


2.内存生长方向
小端对齐 :低字节放在低地址,高字节放在高地址(多)
大端对齐 :高字节放在低地址,低字节放在高地址(服务器)
示例代码:
//1. 栈的生长方向 void test01(){ int a = 10; int b = 20; int c = 30; int d = 40; printf("a = %d\n", &a); printf("b = %d\n", &b); printf("c = %d\n", &c); printf("d = %d\n", &d); //a的地址大于b的地址,故而生长方向向下 } //2. 内存生长方向(小端模式) void test02(){ //高位字节 -> 地位字节 int num = 0xaabbccdd; unsigned char* p = # //从首地址开始的第一个字节 printf("%x\n",*p); printf("%x\n", *(p + 1)); printf("%x\n", *(p + 2)); printf("%x\n", *(p + 3)); } |
边栏推荐
猜你喜欢

Unittest框架的测试日志
![Undefined functions or variables [explained in one article] (matlab)](/img/fe/54272b8efce87ed7a78ac43b1fc189.png)
Undefined functions or variables [explained in one article] (matlab)

南京大学 静态软件分析(static program analyzes)-- introduction 学习笔记

Unittest框架

一体化伺服电机与施耐德PLC TM241CEC24T在Canopen协议下的应用

中国游戏的“外卷”大时代,中小厂商如何破解出海难题?

Design a print function to print the whole tree

Niuke.com: large number addition

Machine learning model monitoring (Apria)

Beaucoup de sociétés de logiciels sont en fait des "blagues"
随机推荐
Pytest--生成测试报告
Yaml data driven demo
Test log of unittest framework
Postman基本操作
今年的 618 不行了?
招募令|数据可视化开发平台“FlyFish”「超级体验官」招募啦!
Design a print function to print the whole tree
QT5知识:字符串列表QStringListModel
Yaml文件详解
UDP和TCP的对比
使用PicGo-Core 和 阿里云 实现typora图片自动上传
既不是研发顶尖高手,也不是销售大牛,为何偏偏获得 2 万 RMB 的首个涛思文化奖?
Google Earth engine (GEE) - sentinel-1 comprehensively check the difference between automatic landslide monitoring before and after two months (Guatemala as an example)
Three color mark removal method
Postman basic operations
[从零开始学习FPGA编程-38]:进阶篇 -语法-函数与任务
D improve translation
Qt 知识:使用 QGraphicsPixmapItem类
Ares Ares I pledged LP mining crowdfunding model DAPP smart contract customization
uni-app框架学习笔记