Data structure during running
[Segment]
Text segments are also called code segments;
The data segment contains initialized global and static variables and their values;
The BSS (block started by symbol) segment contains uninitialized global variables and static variables;
The stack segment (stack) contains local variables, temporary data, parameters passed to the function, and is generated during runtime;
Heap is used to dynamically allocate memory (malloc). Common segment errors and memory leaks occur in the heap;
[Three Executable File segments]
Cjok @ Ubuntu :~ /Learn/C $ size A. out text data BSS dec hex filename 1017 264 8 1289 509 A. Out
[Comparison between segments and codes]
[Layout of segments in the executable files in the runtime in the memory]
If you have any questions, please contact me <cjok.liao@gmail.com> or leave a comment, we will exchange views, it's good for us, so great!