Which of the following statements is/are not correct for preprocessor directive declaration?

Options
- #include< iostream.h>
- #include< iostream.h> #define LEFT 1
- #define LEFT 1
- #define ABS(a) (a)<0 ? –(a) : (a)


CORRECT ANSWER : #include< iostream.h> #define LEFT 1

Discussion Board
C++ - Preprocessor Directives

#include< iostream.h> #define LEFT 1 statement is not correct for preprocessor directive declaration.
A program which processes the source code before it passes through the compiler is known as preprocessor.
The commands of the preprocessor are known as preprocessor directives. It is placed before the main(). It begins with a # symbol.

The preprocessor directives are divided into four different categories which are as follows:

1. Macro expansion : A macro name is generally written in capital letters. If suitable and relevant names are given macros increase the readability.

2. File inclusion : The file inclusion uses the #include. There are two ways of the file inclusion statement:
i) #include “file-name”
ii) #include

3. Conditional compilation : The conditional compilation is used when we want certain lines of code to be compiled or not.
It uses directives like #if, #elif, #else, #endif.

4. Miscellaneous directive : There are some directives which do not fall in any of the above mentioned categories. There are two directives:
i) #undef
ii) #pragma

Prajakta Pandit 01-29-2017 11:08 PM

Write your comments


Enter the code shown above:

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


Advertisement