#include int maxf (int x, int y) { return x > y ? x : y; } #define MAXM(X,Y) ((X) > (Y) ? (X) : (Y)) int errors = 0; void check3 (int a, int b, int c, int expected) { int result = MAXM (MAXM (a, b), c); if (result != expected) { printf ("For maxf (maxf (%d, %d), %d), expected %d, got %d.\n", a, b, c, expected, result); ++errors; } } // max3 int main () { // Check various permutations check3 (1, 2, 3, 3); check3 (1, 3, 2, 3); check3 (2, 1, 3, 3); check3 (2, 3, 1, 3); check3 (3, 1, 2, 3); check3 (3, 2, 1, 3); return errors; } // main