Static use method in C language

Source: Internet
Author: User

A, c program storage space layout

The C program has been composed of the following parts:

1 The body section--cpu the execution machine instruction part; A program has only one copy; read-only to prevent the program from modifying its own instructions as a result of an accident;

2 Initialize the data segment (data segment)--All global variables with initial values in the program are stored here.

3 non-initialized data segment (BSS segment)--The global variable not initialized in the program; the kernel initializes this segment to 0.

4 Stack-growth direction: From top to bottom growth; automatic variables and the information that needs to be saved each time a function is called (return address; Environment information).

5) heap-dynamic storage points.

|-----------|
| |
|-----------|
| 栈 |
|-----------|
| | |
| |/ |
| |
| |
| /| |
| | |
|-----------|
| 堆 |
|-----------|
| 未初始化 |
|-----------|
| 初始化 |
|-----------|
| 正文段 |
|-----------|

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.