Wednesday, November 2, 2011

Features of C Preprocessor in C programming language

There are several steps involved from the stage of writing a C program to the stage of getting it executed. Figure 7.1 shows these different steps along with the files created during each stage. You can observe from the figure that our program passes through several processors before it is ready to be executed. The input and output to each of these processors is shown in Figure 7.2.
Note that if the source code is stored in a file PR1.C then the expanded source code gets stored in a file PR1.I. When this expanded source code is compiled the object code gets stored in PR1.OBJ. When this object code is linked with the object code of library functions the resultant executable code gets stored in PR1.EXE.

The preprocessor offers several features called preprocessor directives. Each of these preprocessor directives begin with a # symbol. The directives can be placed anywhere in a program but are most often placed at the beginning of a program, before the first function definition. We would learn the following preprocessor directives here:
(a) Macro expansion
(b) File inclusion












(c) Conditional Compilation
(d) Miscellaneous directives
Let us understand these features of preprocessor one by one.

3 comments:

  1. I’m impressed, I must say. Rarely do I come across a blog that’s both equally educative and amusing, and let me tell you, you have hit the nail on the head. The problem is something which not enough folks are speaking intelligently about. website Now i'm very happy that I stumbled across this in my hunt for something regarding this.

    ReplyDelete