Difference Between Macro and Function This is not just applicable to C but all languages where we have a concept of preprocessing.
Macro is preprocessed execution i.e. macro processing takes place before compilation whereas function is compiled in short for macro before compilation macro name is replaced by macro value but for the function call, Transfer of Control takes place
For macro no typechecking is done where as for function compiler do the type checking.
Since macro is preprocessed and code is replaced before compilation so code length Increases in Macro which is not applicable to function.
Improper use of macro can lead to side effect see the following example
Now when we call
square(2+5) it is replaced with
(2+5*2+5) i.e. 17 in place of 49
Macro is preprocessor but at run time macro provide better speed.
Macro does not Check Compile Errors where as Function Checks.
My Interpretation - Macro is useful for small but reusage code but function is useful for large code.