Macros with Arguments
Learn how macros can be used with arguments in a manner similar to function calls.
We'll cover the following...
We can use #define
directives to create macros in more advanced ways, such as by including an expression or code statements in the body of a macro. We can also use parameters with the macro name, which allows us to use it much the same way we would use a function.
A first example
For example, we could define a macro to perform the square of a number like this:
Press + to interact
#define SQUARE(n) ( n * n )
Then we could ...