

A macro is a named block of instructions that is expanded inline during compilation or assembly. It helps automate repeated code and improves readability.
When a macro name is used, the macro processor replaces it with its actual body of instructions.
This happens before program execution. The code is copied wherever the macro is called, reducing typing and repeated coding.
Example:
#define SQR(x) ((x)*(x))
y = SQR(5);
Expands to:
y = ((5)*(5));
A macro can be defined once and used many times in a program.
This avoids rewriting the same logic repeatedly and reduces programming effort.
Example:
#define PI 3.14
area = PI * r * r;
circumference = 2 * PI * r;