Functional Macros in C
A function-like macro (also called a parameterised macro) accepts arguments and expands them inline — like a function, but done at the preprocessor stage before compilation. They are faster than function calls because there is no function call overhead.Syntax
Examples
Square of a number:Complete Program
Why Parentheses Matter
Without parentheses around parameters, expressions involving operators can produce wrong results:Macros vs Functions
Use macros for short, frequently-called operations. Prefer
inline functions in C99+ for type safety.