1.14 Basics of A Typical C Environment: Phases of C Programs: 1. Edit 2. Preprocess 3. Compile 4. Link 5. Load 6. Execute
1.14 Basics of A Typical C Environment: Phases of C Programs: 1. Edit 2. Preprocess 3. Compile 4. Link 5. Load 6. Execute
Program is created in the editor and stored on disk. Preprocessor program processes the code. Compiler creates object code and stores it on disk. Linker links the object code with the libraries, and stores it on disk
Preprocessor
Disk
Compiler
Disk
Linker
Disk
Primary Memory
Loader
Disk
Primary Memory
CPU
. . . . . .
CPU takes each instruction and executes it, possibly storing new data values as the program 1 executes.
Documentation Section
Single Line Comment Multiline comment This is an optional section.
2.
Preprocessor Directives
Compiler preprocessor statements. Link compiler functions like cout, cin, sqrt, clrscr, etc. with the INCLUDE subdirectory having header files like iostream.h, conio.h #include<header file>
3. Global Declaration Section (variable or functions) 4. Main program function called main() 5. Beginning of the program: Left brace {
Local declaration Executable part