C language stack "that thing"

This article is mainly about our C language, it is important knowledge: the stack. Life is a battle with himself (ha ha ha), in order to develop faster, more convenient, so starting today we will go into the focus of knowledge of the C language. (If you want to see single-chip stack areas, please click: single-chip stack those things , in fact, knowledge is the same), the abstract becomes concrete here talk about:

First clear that heap and stack are two data structures . The following will be an abstract idea of what we know:

Stack (like data loaded barrel or box, it is like a bullet clip ): having a LIFO data structure properties, i.e. after storage of the first take, taken after the first storage . This is like something to be out on the bottom inside the box (object placed relatively early), you must first remove the pressure on it an object (an object placed relatively late).

Reactor (as an inverted tree ): a sorted a tree data structure , the nodes of each tree has a value . It said data stack structure generally refers to binary heap . The reactor is characterized by a minimum value of the root node (or maximum) , and the root node is a stack of two subtrees. Because of this feature of the stack, used to implement the priority queue , stack access is random, just as in books on a library shelf to take, although the book is placed in sequential time, but would like to take any one do not like Like the stack , first remove all the previous books, bookshelves this mechanism is different from the case , we can take directly to a book we want .

C language program memory allocation in the heap and stack, in general, or a program stored in the Flash Rom. C language program after compiling compiled connected to form the binary image file is formed by a connection stack, heap, data segment and code segments.

Wherein the stack area: at a relatively high address , growth-direction address for the words, the stack grows downwards address, automatically assigned by the system. ;

Heap: is upward growth of the memory space allocated for application programmers, need to apply for their own programmers.

Well, late, to organize this, and we hope in my heart for the stack has a specific understanding of it, if not understand, then it would look again (ha ha ha!)

 

Published 32 original articles · won praise 41 · views 60000 +

Guess you like

Origin blog.csdn.net/qq_21990661/article/details/104761727