Ellipsis and void

An ellipsis at the end of a parameter declaration indicates that the number of arguments is equal to, or greater than, the number of specified argument types. At least one parameter declaration must come before the ellipsis. Where it is permitted, an ellipsis preceded by a comma is equivalent to a simple ellipsis.

      int f(int,...);

The comma before the ellipsis is optional in C++ only

Parameter promotions are performed as needed, but no type checking is done on the variable arguments.

You can declare a function with no arguments in two ways:

      int f(void);      // ISO/ANSI C Standard

      int f();          // C++ enhancement
                        // Note: In ISO/ANSI C, this declaration means that
                        // f may take any number or type or parameters

An empty argument declaration list or the argument declaration list of ( void) indicates a function that takes no arguments. void cannot be used as an argument type, although types derived from void (such as pointers to void) can be used.

In the following example, the function f() takes one integer parameter and returns no value, while g() expects no parameters and returns an integer.

void f(int);
int g(void);