A C program can have the following kinds of variables. 1) Global variables: a) default global variables i) initialized ii) uninitialized b) static global variables i) initialized ii) uninitialized c) external global variables 2) Local variables: a) automatic local variables i) initialized ii) uninitialized b) static local variables i) initialized ii) uninitialized c) formal parameters d) external local variables NOTE: For each of the above kinds of variables, you should be able to specify its scope and its lifetime. ------------------------------------------------------------------------ A running C program is made up of the following parts. 1) Code: a) your code b) library code c) operating system code 2) Data: a) initialized data segment b) uninitialized data segment c) read-only data segment (?) d) stack data e) heap data NOTE: Each kind of C variable mentioned in the first part is stored in one of the 5 data areas listed just above. You should be able to specify which kind of variable is stored in which kind of data area. ------------------------------------------------------------------------- Here are the steps involved in converting a source code file into a running program. Along with each step is listed the tools that you can use to observe the result of that step. Using these tools, you can take a simple C program and observe into which data area listed above each of the kinds of variables listed in the first part above gets stored. C Source Code -------> text editor | | | Compiler | | Assembly Source Code --> text editor | | | Assembler (built into the complier) | | obj file ---------> PE Dump (comes with Win32-LCC) | Dumpbin (comes with Visual Studio) | PEview (www.magma.ca/~wjr/) | | Linker | | exe file ---------> PE Dump | Dumpbin | PEBrowse (www.smidgeonsoft.com) | Depends (www.dependencywalker.com) | Loader | | runtime image ------> Process Walker (a virtual memory mapper) Visual Studio debugger PEBrowseDbg (www.smidgeonsoft.com) Process Explorer (www.sysinternals.com) Process Viewer API Monitor (www.rohitab.com) NOTE: One interesting thing to note is that at every step of the above process you can use at least one of the tools listed to get an "assembly language" listing of the result of that step. Take a simple program, look at its assembly language at each of these steps and notice how the assembly language is modified a bit at each step. In particular, each step resolves more symbols into addresses than the previous step.