Text段、Data段和BSS段
2016-10-29 10:19
211 查看
不同的compiler在编译的过程中对于存储的分配可能略有不同,但基本结构大致相同。
大体上可分为三段:Text段、Data段和BSS段。
View Code
大体上可分为三段:Text段、Data段和BSS段。
1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<iostream> 4 #include<string.h> 5 using namespace std; 6 7 static int a=1;//全局初始化区 8 int b=2;//全局初始化区 9 char *p;//全局未初始化区 10 char *p2;//全局未初始化区,BSS段 11 int *p3;//全局未初始化区 ,BSS段 12 int *p4;//全局未初始化区 ,BSS段 13 char *p5={"555555555"};//全局初始化区 14 15 int main(){ 16 static int c=3; 17 int d=4;//内存栈 18 int e=7;//内存栈 19 20 char *p6={"555555555"}; 21 p=(char*)malloc(sizeof(char)*10);//内存堆 22 p2=(char*)malloc(sizeof(char)*10);//内存堆 23 p3=(int*)malloc(sizeof(int));//内存堆 24 p4=(int*)malloc(sizeof(int)*10);//内存堆 25 for(int i=0;i<=9;i++)p4[i]=0x1; 26 27 28 *p3=0x123; 29 strcpy(p,"123456789");//文字常量区 30 strcpy(p2,"987654321"); 31 strcpy(p2,"123456789"); 32 }
View Code
相关文章推荐
- bss段、data段和text段
- BSS段 data段 text段 堆heap 和 栈stack
- text段,data段,bss段,堆和栈
- Linux段管理,BSS段,data段,.rodata段,text段
- text段,data段,bss段,堆和栈
- [C语言内存分配] text段,data段,bss段
- text段、data段(堆和栈)和bss段
- bss段、data段、text段、堆(heap) 和 栈(stack)
- text段,data段,bss段,堆和栈
- text段,data段,bss段,堆和栈
- Linux段管理,BSS段,data段,.rodata段,text段
- 转载一篇 写的很好 ,学习了 text段,data段,bss段
- text段,data段,bss段,堆和栈
- Linux段管理,BSS段,data段,.rodata段,text段
- (深入理解计算机系统) bss段,data段、text段、堆(heap)和栈(stack)
- (深入理解计算机系统) bss段,data段、text段、堆(heap)和栈
- text段,data段,bss段,堆和栈
- text段,data段,bss段,堆和栈
- text段、data段和bss段介绍
- text段,data段,bss段,堆和栈