MENU
Question -

Define Macro with suitable example.



Answer -

Macro are preprocessor directive created using # define that serve as symbolic constants.
They are created to simplify and reduce the amount of repetitive coding.
For instance,
#define max (a, b) a > b ? a : b
Define the macro max, taking two arguments a and b. This macro may be called like any
C function with similar syntax. Therefore, after preprocessing.
A = max (x, y);
BecomesA = x>y ?x:y;

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×