In C++11 the following function declaration:
int f(void);
means the same as:
int f();
A pa
In C++, there is no difference. However, this is inherited from C, where int f()
mean "function which can take any number of arguments of any types" and int f(void);
specifies functions that takes no arguments.
Edit As Angew pointed out, in C, f() means "function whose parameters are unknown at this point." It does not mean it can take any number of arguments - close to that would be f(T arg, ...)
, where arg
is at least one named parameter before ...
, which accepts at least one argument, arg
(as pointed by @hvd).