C中的内存段-文本段 [英] Memory Segments in C — Text Segment
问题描述
有人可以告诉我C语言中的文本段"是什么,如果可以的话,请给我看一个简单的示例?
Can someone tell me what is a 'text segment' in C, and if possible show me a simple example?
推荐答案
Unix系统上程序的文本"段是代码—机器代码,组成程序的功能(尤其包括main()
(如果程序是用C或C ++编写的).它还可以包含只读数据.经典程序中的其他段是数据"段和"bss"段. 数据"段保存初始化的数据; "bss"段保存归零的数据.运行后,数据段和bss段将无法区分.
The 'text' segment of a program on Unix systems is the code — the machine code, the functions that make up the program (including, in particular, main()
if the program is written in C or C++). It can also include read-only data. The other segments in a classic program are the 'data' segment and the 'bss' segment. The 'data' segment holds initialized data; the 'bss' segment holds zeroed data. Once running, the data and bss segments are indistinguishable.
您还最终得到了堆栈和堆".
You also end up with the stack and 'the heap'.
这篇关于C中的内存段-文本段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!