简体   繁体   English

C中的内存段-文本段

[英]Memory Segments in C — Text Segment

有人可以告诉我C语言中的“文本段”是什么,如果可以的话,请给我看一个简单的示例?

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++). 在Unix系统上,程序的“文本”部分是代码—机器代码,组成程序的函数main()如果程序是用C或C ++编写的,则尤其包括main() )。 It can also include read-only data. 它还可以包含只读数据。 The other segments in a classic program are the 'data' segment and the 'bss' segment. 经典程序中的其他段是“数据”段和“ bss”段。 The 'data' segment holds initialized data; “数据”段保存初始化的数据; the 'bss' segment holds zeroed data. “ bss”段保存归零的数据。 Once running, the data and bss segments are indistinguishable. 一旦运行,数据段和bss段将无法区分。

You also end up with the stack and 'the heap'. 您还最终得到了堆栈和“堆”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM