How can I call (not define) a function with a variable number of arguments in C?

前端 未结 6 1766
感情败类
感情败类 2021-01-20 01:05

Is there any way to make this code shorter?

long call_f(int argc, long *argv) {
  switch (argc) {
    case 0:
      return f();
      break;
    case 1:
             


        
6条回答
  •  借酒劲吻你
    2021-01-20 01:33

    You can check out my answer to:

    Best Way to Store a va_list for Later Use in C/C++

    Which seems to work, yet scare people. It's not guaranteed cross-platform or portable, but it seems to be workable on a couple of platforms, at least. ;)

提交回复
热议问题