Memory organisation in C is divided into below categories namely
Get Tashi George’s stories in your inbox
Join Medium for free to get updates from this writer.
Text Segment where all executables are stored. It is also called code segment.
Initialized data segment where initialized variables are stored. It stores initialised global and static variables other than Zero.
Unintialized data segment where uninitialized global and static variables are stored. It is also called bss (block started by symbol).
Heap memory where dynamically allocated variables are stored. Heap memory can be accessed indirectly. In the example below Heap memory is addressed through a pointer in stack.
Stack memory contains functions and local variables. Size of stack is static and is decided at compilation time while it is allocated at runtime.