Preprocessor commands are called DIRECTIVES, and begin with a pound / hash symbol(#).
|
Note : No white space should appear before the #, and a semi colon is NOT required at the end. The #define preprocessor allows us to define symbolic names and constants :
This statement will translate every occurrence of PI in the program (Example: #define PI 3.14159 ).
Before compilation, if the C++ preprocessor finds the MAX as one word, in the source code, it replace the number (Example: #define MAX 70 ).
Every time the preprocessor sees NAME it will replace it(Example : #define NAME"Computer Science C++"). This feature is particularly use for defining 'magic' numbers. An advanced use of #define is in the creation of macros.
Some time Create a big structure program using #define is helping much so, lets make a simple structure program using #define MAX in C++ language.
|
It's a special area where you can find special questions and answers for CSE students or IT professionals. Also, In this section, we try to explain a topic in a very deep way.