| Macro | Function |
|---|
| Text replace by the preprocessor | Compiled code that is called |
| No type checking | Types are checked |
| Code is copied at each use (bigger program) | One copy of the code |
| Faster, no call overhead | Small call overhead |
Arguments can run two times (SQUARE(i++)) | Arguments are evaluated once |
Use a function when you can. Use macros for constants and small tricks only. See Preprocessor and Macros.
Learn more about the similar topics:
| Tutorials |
| No Content Found. |
| Exercises & Assignments |
| No Content Found. |
| Interview Questions & Answers |
| No Content Found. |