2. C Development Environment Phase 2 : Preprocessor program processes the code. Preprocessor Disk Disk Compiler Phase 3 : Compiler creates object code and stores it on Disk . Disk Linker Phase 4 : Linker links object code with libraries, creates a.out and stores it on Disk. Editor Phase 1 : Program is created in the Editor and stored on Disk. Disk
3. Loader Phase 5 : : . Primary Memory Loader puts Program in Memory C P U Phase 6 : : . Primary Memory CPU takes each instruction and executes it, storing new data values as the program executes.
4. From code to executables Executable Code Pre-processor Source Code Compiler Assembler Linker Libraries Assembly Code Object Code
5. A Simple Program Example #include <stdio.h> main() { printf("Programming in C is easy."); } Sample Program Output Programming in C is easy.
6.
7. The purpose of the statement #include <stdio.h> is to allow the use of the printf statement to provide program output. Text to be displayed by printf() must be enclosed in double quotes. The program has only one statement printf("Programming in C is easy."); printf() is actually a function (procedure) in C that is used for printing variables and text. Where text appears in double quotes "", it is printed without modification. There are some exceptions however.
8. This has to do with the and % characters. These characters are modifiers, and for the present the followed by the n character represents a newline character. Thus the program prints Programming in C is easy. and the cursor is set to the beginning of the next line. As we shall see later on, what follows the character will determine what is printed, ie, a tab, clear screen, clear line etc. Another important thing to remember is that all C statements are terminated by a semi-colon ;
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19. Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable declaration Variable definition
20.
21.
22.
23.
24.
25.
26.
27.
28. Format Specifier Tells the printf() function the format of the output to be printed put.
29. Escape Sequence Escape sequence is used in the printf() function to do something to the output.