Preprocessor Directives: The processor directives are the Direction given to the compiler to carry out specific task even before compilation of the program start. Since we are directing the complier to carry out specific task before the compilation process start is refer as preprocessor director eves. The preprocessor directives are not statement of language. This directives starts with #.  The preprocessor directives never end with semicolon. Following are the commonly use predirectives: a )# define: The preprocessor # define is used to declare the symbolic constants.   Consider the following example  # define PI 3.14159 In the above example we define a symbolic constant name as PI whose equivalent value will be 3.14159 with this directives we have informed the compiler that the PI is symbolic constant with it’s own value. Once the compilation of the program start where are the PI occurs in the program, it will be request by it’s equivalent value. b) # include :  The preprocessor directives # include is used to include specific files within program.                There are the may facilities available in the core of C++ language. However, there are many more facilities which are available outside of the core of C + +. This files are called as header files and also called as the library files. Consider the following example: 1.To use the mathematically facilities such as sin ( ), COS ( ), log ( ), sqrt ( ) etc are called as the math h must be included so that if we use any of the above discussed facilities the compilation error will not error and facilities will become accessible. 2 .The scanf ( ) and printf ( ) are the function for reading and displaying data. To use these function are have to include a file called as stdio.h. The corresponding preprocessor directives will be given as follows        . The stdio.h to the standard input output file Once we include file stdio.h we can use scanf ( ) and printf ( ) in our program. 3.The cin ( ) and cout are the object which are used for reading and displaying the data. To use this object we have to include a file called as lostream.h the corresponding preprocessor directives will be given as follows.                                 # include < iostream.h > To isostream h refers to the input output stream header file. Once we include the file iostream.h we can used cin and cout in our program There are few more preprocessor directives used in C + + . Those are instead as follows. # if # else # elif # end if # ifdef # lfndef      

Like it on Facebook, +1 on Google, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet