CSC365 Compiler Design and Construction

Compiler Design and ConstructionModel question

What is a macro? Differentiate between macro and procedure. Explain macro expansion with example. Show the complete macro expansion for: define SQUARE(x) ((x) (x)) define MAX(a, b) ((a) (b) ? (a) :…

5

What is a macro? Differentiate between macro and procedure. Explain macro expansion with example.

Show the complete macro expansion for:

#define SQUARE(x) ((x) * (x))

#define MAX(a, b) ((a) > (b) ? (a) : (b))

#define CUBE(x) (SQUARE(x) * (x))

result = MAX(SQUARE(3), CUBE(2));

A worked answer is on its wayMeanwhile, read the Compiler Design and Construction notes for this topic.

Discussion

Loading…

More Compiler Design and Construction questions

All Compiler Design and Construction old questions