Memory Segments in C — Text Segment

前端 未结 1 1716
-上瘾入骨i
-上瘾入骨i 2021-01-06 16:16

Can someone tell me what is a \'text segment\' in C, and if possible show me a simple example?

1条回答
  •  醉梦人生
    2021-01-06 16:26

    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'.

    0 讨论(0)
提交回复
热议问题