void xyz();
In C, this tells the compiler that we don't know anything about the
parameters of subroutine xyz
. Consequently, you can use the following
invocation:
xyz(23);
or
xyz(0.5);
and etc. The compiler takes the first invocation as a template. If we
pass an integer in the first invocation, the compiler thinks that the
proper way to call xyz
is to have one integer parameter.
Leaving it up to the compiler to determine the number and type(s) of parameter(s) is a very bad idea.
In C++, the same prototype is the same as the following:
void xyz(void);
This means, explicitly, that xyz
has no parameters.
As a general rule, never use an empty parameter list.