Computer Science, asked by shivadeb2000gmailcom, 1 year ago

Illustrate the use of #define in C++ to define a macro.

Answers

Answered by DeathViperLP02
1

its good to see someone is doing c++... yesterday was my class 12 c++ exam...final...

Ans #define preprocessor directive is used to define symbolic constant in a program. The #define identifier replacement is also known as a macro definition or simply a macro macros may be define with zero or more arguments. A macro without argument is used to define a symbolic constant and a macro with arguments is used to replace expressions or code fragments in a program. A macro define is not terminated by semicolon.

Example:

#define LIMIT 10 //Symbolic constant

#define sqr(x) (x*x) //Macro

Similar questions