Header Files - OOP

Q.  Use of preprocessor directive in OOP
- Published on 19 Oct 15

a. for conditional compilation
b. for macro expansion
c. error and warning reporting
d. all the above

ANSWER: all the above
Preprocessor is a program that processes an input to produce an output which is used as another programs input. The preprocessor directives are generally invoked by the compiler to process before compilation. The preprocessor directive are capable of performing simple textual substitutions, macro expansion, conditional compilation, warning and error reporting. It begins with special character # followed by directive name. Preprocessor directive statement does not end with a semi colon. Few examples of preprocessor directives are:

#include, #define, #undef, #if, #elif, #else, #endif, #line etc. It is used in various OOP languages like C, C++, C#. It has no use in Java.

Post your comment / Share knowledge

Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)