First page Back Continue Last page Summary Graphics
Programs and Memory
Each programs is assigned a virtual memory space:
Stack: stores variables that are local to functions; when a function is called, its automatic variables are allocated on the top of the stack; when it ends, its variables are de-allocated.
Heap: place for variables that are created with malloc, calloc, realloc and disposed of with free.
Data: initialized variables including global and static variables, un-initialized variables.
Code (text): the program instructions to be executed.