+ 3
What is preprocesser in c++??
c+
4 Answers
+ 5
The preprocessors are the directives, which give instructions to the compiler to pre process the information before actual compilation starts i.e. it provides ability to include the header files
+ 2
Hope this can explain and clear the doubts
http://www.cplusplus.com/doc/tutorial/preprocessor/
+ 2
The preprocessors are the directives, which give instructions to the compiler to preprocess the information before actual compilation starts.
All preprocessor directives begin with #, and only white-space characters may appear before a preprocessor directive on a line. Preprocessor directives are not C++ statements, so they do not end in a semicolon (;).
You already have seen a #include directive in all the examples. This macro is used to include a header file into the source file.The preprocessor is either a separate program invoked by the compiler or part of the compiler itself. It performs intermediate operations that modify the original source code and internal compiler options before the compiler tries to compile the resulting source code.
The instructions that the preprocessor parses are called directives and come in two forms: preprocessor and compiler directives.
Preprocessor directives direct the preprocessor on how it should process the source code, and
compiler directives direct the compiler on how it should modify internal compiler options. Directives are used to make writing source code easier (by making it more portable, for instance) and to make the source code more understandable. They are also the only valid way to make use of facilities (classes, functions, templates, etc.) provided by the C++ Standard Library.
There are number of preprocessor directives supported by C++ like #include, #define, #if, #else, #line, etc. Let us see important directives â
The #define preprocessor directive creates symbolic constants. The symbolic constant is called a macro and the general form of the directive is â
#define macro-name replacement-text
When this line appears in a file, all subsequent occurrences of macro in that file will be replaced by replacement-text before the program is compiled.
+ 2
Preprocessor directives is like an whole new language inside c whenever you compile the code first it will be passed through the preprocessor which will look for preprocessor directives. Preprocessor directives start with a # sign and are used making macros to include text in your code like in header files these instructions are executed before the actual compilation process. Preprocessor directives are a great tool they can be used in place of global constants but they should be used carefully