2 AnswersNew Answer
When we talk about the memory layout of a C program there are a number of common sections involved: Text Section - where the code goes Data Section - where initialised variables go BSS Section - where uninitialised variables go Heap - used to provide memory for dynamically allocated variables Stack Section - used to pass arguments to functions, hold local variables, stores cpu registers between functions as required. As a C programmer most of this is taken care of by the compiler and linker so you don't need to think about it. If you create embedded C programs you may need to get very intimate with these concepts if you have to write your own linker scripts.
•https://www.sololearn.com/discuss/1146851/?ref=app •https://www.sololearn.com/discuss/1869415/?ref=app •https://www.sololearn.com/discuss/239629/?ref=app •https://www.sololearn.com/discuss/94942/?ref=app Stack is a linear data structure whereas Heap is a hierarchical data structure. Stack variables can't be resized whereas Heap variables can be resized. Stack memory is allocated in a contiguous block whereas Heap memory is allocated in any random order. © https://www.guru99.com/stack-vs-heap.html