Question:

Which keyword is used to define macros in C++ ?

Show Hint

All preprocessor directives in C/C++ start with a hash symbol (`\#`). Common ones include `\#include`, `\#define`, `\#ifdef`, and `\#endif`.
  • \# macro
  • \# define
  • macro
  • define
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Understand macros in C++. Macros are a feature of the C++ preprocessor. They allow you to define a token that will be replaced by a set of characters before the code is compiled.
Step 2: Identify the preprocessor directive. The directive used to create a macro is \text{\#define}. The hash symbol `\#` indicates that it is a preprocessor directive. For example: `\#define PI 3.14159`. The preprocessor will replace every instance of `PI` in the code with `3.14159`.
Was this answer helpful?
0
0