// file: $(ECE_1111)/lectures/lecture_29/example.h // // revision history: // 20240329 (JP): initial version // // make sure definitions are only made once // #ifndef EXAMPLE #define EXAMPLE // include system libraries // #include #include #include #include #include #include // simple #define // #define STRING1 "A macro definition" #define STRING2 "%0.20s\n" // #define with math expressions // #define EXPRESSION1 1 + 2 + 3 + 4 #define EXPRESSION2 EXPRESSION1 + 10 // macros using #define // #define ABS(x) ((x < 0) ? -(x) : (x)) #define MAX(a,b) ((a < b) ? (b) : (a)) #define BIGGEST(a,b,c) ((MAX(a,b) < c) ? (c) : (MAX(a,b))) // comparison functions // int compare_doubles(const void *a, const void *b); int compare_chars (const void *a, const void *b); // end of include file // #endif