0258-variadic.c (351B)
1 #define A(x,y) x+y 2 #define B(x,y, ...) (x+y+ __VA_ARGS__ ## 0) 3 #define C(x, ...) test(x, __VA_ARGS__) 4 5 int 6 test(int n1, int n2, int n3, int n4) 7 { 8 return n1 + n2 + n3 + n4; 9 } 10 11 int 12 main(void) 13 { 14 int x = 3; 15 16 if (A(1,x) != 4) 17 return 1; 18 if (B(1,x) != 4) 19 return 2; 20 if (B(2,x,3) != 35) 21 return 3; 22 if (C(1, 2, 3, 4) != 10) 23 return 4; 24 25 return 0; 26 }