Skip to content
Question Bank (2 marks) · Q3

Q.Briefly explain #define deirective.

Karnataka PUCTextbookShort· 2mImportance★★★★★est
10% · 16/154 Questions
✓ Free question

[!TLDR]

#define creates a symbolic constant or macro that the preprocessor substitutes throughout the program.

The #define directive is used to give a name to a constant value or a small piece of code (a macro). Before compilation, the preprocessor replaces every use of that name with the defined text. This makes programs easier to read and to modify, because the value need be changed in only one place.

#define PI 3.14
#define MAX 100

Here, wherever PI appears in the program, it is replaced by 3.14.

[!ANSWER]

The #define directive defines a symbolic constant or macro, and the preprocessor substitutes the defined value wherever the name is used (e.g. #define PI 3.14).

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.