You are on page 1of 5

1.

14 Basics of a Typical C Environment


Editor Disk

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

Phases of C Programs: 1. Edit 2. Preprocess 3. Compile 4. Link 5. Load 6. Execute

Compiler

Disk

Linker

Disk
Primary Memory

Loader

Disk

Loader puts program in memory.


. . . . . .

Primary Memory

CPU

. . . . . .

CPU takes each instruction and executes it, possibly storing new data values as the program 1 executes.

Basic Structure of C++ Program


1.

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

6. End of main program } 7. Sub-program section or user defined program

Variable Constant Identifier Keyword Data type

You might also like