#include #include #define min(b,c) ((b) < (c) ? (b) : (c)) /* * A potential hazard of macros is the side affect operators in * argument expressions. In this example, if b is less than c, * b gets incremented twice, which was not intended. * * a = min(b++, c) gets translated to * * a = (b++) < (c) ? (b++) : (c) * */ int main(void) { int b = 4; int c = 6; int return_val; printf("Input value of b: %d\n", b); printf("Input value of c: %d\n", c); return_val = min(b++,c); printf("Output value of b: %d\n", b); printf("Output value of c: %d\n", c); printf("Return value from min(b,c): %d\n", return_val); return EXIT_SUCCESS; }