Skip to main content

Posts

Showing posts with the label Heap segment

Memory layout in c program?

The distinction between stack and heap relates to programming. When you look at your computer memory, it is organized into three segments: •text (code) segment •stack segment •heap segment text (code) segment The text segment (often called code segment) is where the compiled code of the program itself resides. When you open some EXE file in Notepad, you can see that it includes a lot of "Gibberish" language, something that is not readable to human. It is the machine code, the computer representation of the program instructions -The two sections other from the code segment in the memory are used for data. stack segment The stack is the section of memory that is allocated for automatic variables within functions. Data is stored in stack using the Last In First Out (LIFO) method. This means that storage in the memory is allocated and deallocated at only one end of the memory called the top of the stack. Stack is a section of memory and its associated registers that ...