Storage Class & Memory Layout
Storage Class & Memory Layout
Functions:
Global
Static
Variables:
Constant
Global
o extern
o static
Local
o auto
o register
o static
Storage Class
A storage class defines the scope (visibility) and life-time of variables and/or functions within a C
Program.
Stack Segment
Stack Frame for every function Call
Function Arguments
Local variables (auto)
return value/ address
Stack grows toward lower address
Heap Segment
(Dynamically allocated memory blocks with
malloc()/ calloc())
heaps grows towards higher address
Read/ Write Data Segment
Uninitialized Data Segment (bss)
Initialized Data Segment