fork(2) download
  1. #include <stdio.h>
  2.  
  3. #define __NARGS(_1, _2, _3, _4, _5, VAL, ...) VAL
  4. #define NARGS(...) (sizeof(#__VA_ARGS__) == sizeof("") ? 0 : __NARGS(__VA_ARGS__, 5,4,3,2,1))
  5.  
  6. #define FOO(...) NARGS(__VA_ARGS__)
  7.  
  8. int main()
  9. {
  10. printf("%d\n", FOO()); // prints 0
  11. printf("%d\n", FOO(/*comment*/)); // prints 0
  12. printf("%d\n", FOO(1)); // prints 1
  13. printf("%d\n", FOO(1, 2)); // prints 2
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
0
0
1
2