Benefits of using Macro
What is the Macro? If you write as “#define” in your code, that is “Macro” .
Macro will handle by the preprocessor. You can think Macro as a method to replace the String which appears in you code..
pros: – run faster than writing as function
cons: – occupy memories
concepts: – there is no the concept of pointer in macro. just “replacing the string”
An question: What is the output of the following code?
Answer:
Explanation: “int (*do_something)” is a local function pointer. In the macro, the macro_to_func will be replaced as “minus”, but do_something !!!
Last updated