Memory Layout of a C program
text
heap
stack
initialized data
uninitialized data
read from program file by exec
initialized to zero by exec
command-line arguments
and environment variables
low address
high address
dynamically allocated memory appears in the heap
function invocations and local variables appear in the stack
grow & shrink
as needed
Previous slide
Next slide
Back to first slide
View graphic version