#include #include #include "04-max.h" int main(int argc, char *argv[]) { // use the symbolic constants. At preprocessor time, // the strings "MIN_MONTH" and "MAX_MONTH" are replaced // with the strings "1" and "12" respectively. The resulting source // is then compiled printf("\nMonths range from %d to %d\n", MIN_MONTH, MAX_MONTH); // Use the broken max macro. Again, the preprocessor is doing // string subsitution on the source, before it is compiled. printf("\nInt use (buggy macro):\n"); printf("\tmax(4,5) = %d\n", max(4,5)); printf("\tmax(3+4,5) = %d\n", max(3+4,5)); printf("\t3+max(4,5) = %d\n", 3+max(4,5)); // Here's the same code using the bug-free version printf("\nInt use (working macro):\n"); printf("\tMAX(4,5) = %d\n", MAX(4,5)); printf("\tMAX(3+4,5) = %d\n", MAX(3+4,5)); printf("\t3+MAX(4,5) = %d\n", 3+MAX(4,5)); return EXIT_SUCCESS; }