Published on : 3rd Oct 2021

Memory layout in C programming
Memory layout is my favourite topic in C programming. 😍
We can write a program when we know what is going on behind the scene. We need to visualize a program to write a better program.
Let's discuss various sections one by one.
Code/Text section :
Binary representation of our code is stored in this section.
Global/Static section :
All the global and static variables are stored in this section.
Stack section :
Function arguments and variables inside a function is stored in this section.
Heap section :
Dynamically memory are allocated and deallocated in this section.
CLI arguments and Environment variables :
When we pass arguments to execute a program, the arguments are stored in this section. All the environment variables are also stored in this section.