C/C ++ BASICS (continuous updating)

Source: Internet
Author: User

 

In C ++, memory is divided into five blocks: heap, stack, free storage zone, global/static variable zone, and constant storage zone.

STACK: an area that is automatically cleared when the compiler allocates it as needed. It is usually used to store local variables, formal parameters.

Heap: It is generally a Region allocated by new, and the compiler does not care about this storage region, mainly becauseProgramEmployee control, a new corresponds to a delete. If a memory is allocated with new but not released, it will be automatically withdrawn by the system only when the process ends.

Free storage zone: The Zone allocated by malloc is very similar to the heap. The difference is that it is released with free.

Global/static variable area: used to store global and static variables.

Constant storage area: This is a very special area, and programmers are not allowed to modify the volume (if you have to change it, it is also possible, there are many illegal means, explore it by yourself)

 

 

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.