Macros are different from functions in many ways like: Macros Functions
1. Macros are pre-processed. Functions are compiled.
2. The code length in macros always increases. In functions, the length of the code does not change.
3. Macros do have side effects. Functions do not have any side effects.
4. Compile errors cannot be checked in macros. Compile errors can be checked in functions.
5. Macros are generally useful when small codes appear a number of times. Functions are useful when large codes appear a number of times.
6. Type checking is not required for macros. Type checking is required for functions.

Suggest An Answer

No suggestions Available!