In a C function declaration, what does “…” as the last parameter do?

后端 未结 6 638
借酒劲吻你
借酒劲吻你 2020-11-28 06:56

Often I see a function declared like this:

void Feeder(char *buff, ...)

what does \"...\" mean?

6条回答
  •  佛祖请我去吃肉
    2020-11-28 07:17

    Variadic functions

    Variadic functions are functions which may take a variable number of arguments and are declared with an ellipsis in place of the last parameter. An example of such a function is printf.

    A typical declaration is

        int check(int a, double b, ...);
    

    Variadic functions must have at least one named parameter, so, for instance,

        char *wrong(...);  
    

    is not allowed in C.

提交回复
热议问题