OOP344 Lecture 4 – Week 3 // MACROS & PreProcessing

So in today’s OOP344 class we discussed Macros and Preprocessors

Named Things include:

– Classes, Functions, Variables, Member Variables, and Namespaces

Preprocessor Directives include:

– #include “path begins in directory local to this filename”

– #ifdef, #ifndef, #endif, #else, #elseif, and some others

So a simple example of macros would be the following image(s)Image:

Macros can be tricky because of parentheses and BEDMAS, but not to worry, with a couple more examples, it will all makes more sense!

The following is a worksheet we received in class to complete in class, which used a bunch of cool macro concepts:

Image