C语言中关于段的理解
来源:互联网 发布:淘宝化妆品照片怎么拍 编辑:程序博客网 时间:2024/06/05 04:52
一、
#include <stdio.h>
int main(void)
{
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 7139 2013-10-12 06:29 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
916 264 8 1188 4a4 a.out
二、
#include <stdio.h>
int null[1000];
int main(void)
{
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 7160 2013-10-12 06:25 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
916 264 4032 5212 145c a.out
三、
#include <stdio.h>
int null[1000]={0};
int main(void)
{
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 7160 2013-10-12 06:35 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
916 264 4032 5212 145c a.out
四、
#include <stdio.h>
int null[1000]={1};
int main(void)
{
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 11204 2013-10-12 06:28 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
916 4288 8 5212 145c a.out
五、
#include <stdio.h>
int null[1000]={1};
int main(void)
{
int local[1000];
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 11204 2013-10-12 06:37 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
932 4288 8 5228 146c a.out
六、
#include <stdio.h>
int null[1000]={1};
int main(void)
{
int local[1000] = {1};
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 11204 2013-10-12 06:40 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
#include <stdio.h>
int main(void)
{
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 7139 2013-10-12 06:29 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
916 264 8 1188 4a4 a.out
二、
#include <stdio.h>
int null[1000];
int main(void)
{
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 7160 2013-10-12 06:25 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
916 264 4032 5212 145c a.out
三、
#include <stdio.h>
int null[1000]={0};
int main(void)
{
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 7160 2013-10-12 06:35 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
916 264 4032 5212 145c a.out
四、
#include <stdio.h>
int null[1000]={1};
int main(void)
{
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 11204 2013-10-12 06:28 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
916 4288 8 5212 145c a.out
五、
#include <stdio.h>
int null[1000]={1};
int main(void)
{
int local[1000];
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 11204 2013-10-12 06:37 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
932 4288 8 5228 146c a.out
六、
#include <stdio.h>
int null[1000]={1};
int main(void)
{
int local[1000] = {1};
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 11204 2013-10-12 06:40 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
964 4288 8 5260 148c a.out
七、
#include <stdio.h>
int null[1000]={1};
int main(void)
{
int local[1000] = {1};
printf("hello-world!\n");
return 0;
}
root@ubuntu:/home/albert# gcc -g hello.c
root@ubuntu:/home/albert# ls -al a.out
-rwxr-xr-x 1 root root 12444 2013-10-12 06:51 a.out
root@ubuntu:/home/albert# size a.out
text data bss dec hex filename
964 4288 8 5260 148c a.out
解析:(1)由一、二例子 和 三例子比较知道:BSS段不保存在目标文件中,除了记录BSS段在运行时所需要的大小。注意:当全局变量初始化为0时,也认为是未初始化,故放在BSS段; (2) 由四五六可知,数据段保存在目标文件中;(3)文本段是最容易受优化措施影响的段,注意:a.out文件的大小受调试状态下编译的影响,但是段的大小不受影响。
- C语言中关于段的理解
- C语言中关于位段的简单理解
- C语言段与内存的理解
- C语言位段理解
- 关于C语言的理解
- 关于C语言中main()函数的理解
- 关于c语言中EOF用法的理解
- C语言中关于gets和scanf函数的理解
- 关于C语言中对数组取地址的理解
- 关于C语言中二级指针的理解
- C语言中关于除法和取余的理解
- C语言中关于const与指针结合的理解
- c语言中,关于延迟函数的理解
- c语言中,关于延迟函数的理解
- c语言中,关于延迟函数的理解
- c语言中,关于延迟函数的理解
- c语言中,关于延迟函数的理解
- c语言中,关于延迟函数的理解
- 指针和引用的相同点和不同点
- [堆]种树
- 继承中的构造方法
- Teamviewer ubuntu 提示 TeamViewer Daemon is not running
- C基础库
- C语言中关于段的理解
- 浏览器的工作原理:新式网络浏览器幕后揭秘
- hdu4107 Gangster (线段树,段更新完后求数组内的值)
- linux中断底半部之 softirq 原理与代码分析
- 数组名,数组首地址,a,&a,&a[0]
- 黑马程序员-----踏踏实实基础C#基础(二)
- linux 中断底半部之tasklet分析
- 手机不支持SD卡扩展
- android开发解决Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE