This section illustrates you how to use macros in C.
Macros are the identifiers that represent statements or expressions. To associate meaningful identifiers with constants, keywords, and statements or expressions, #define directive is used. You can see in the given example, we have define a macro i.e SQUARE(x) x*x. Here the macro determines the square of the given number.
Macro Declaration: #define name text
Here is the code:
Output will be displayed as:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: February 5, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles