#define
This is used to define macros. Macros can be simple constants or function
#define PI 3.14159
#define SQUARE(x) ((x) * (x))
int main() {
double radius = 5.0;
double area = PI * SQUARE(radius);
// ...
}#define MAX(a, b) ((a) > (b) ? (a) : (b))
int main() {
int x = 5, y = 7;
printf("Max is: %d\n", MAX(x, y)); // Output: Max is: 7
// Be careful with side effects:
printf("Max is: %d\n", MAX(x++, y++)); // This might not behave as expected
}Last updated