Sitemap

Memory organisation in C

Sep 29, 2021

--

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.

  1. Text Segment where all executables are stored. It is also called code segment.
  2. Initialized data segment where initialized variables are stored. It stores initialised global and static variables other than Zero.
  3. Unintialized data segment where uninitialized global and static variables are stored. It is also called bss (block started by symbol).
  4. 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.
  5. Stack memory contains functions and local variables. Size of stack is static and is decided at compilation time while it is allocated at runtime.
  6. Command line arguments

An example is given below:

Press enter or click to view image in full size

--

--

Tashi George
Tashi George

Written by Tashi George

0 followers

Embedded Firmware developer.