Assuming you are talking about the declaration of your function (rather than calling it - see below), then the following (from here), should answer your question:
The declarators f()
and f(void)
have different meaning: the declarator
f(void)
is a new-style (prototype) declarator that declares a function
that takes no parameters. The declarator f()
is an old-style (K&R)
declarator that declares a function that takes an unspecified number of
parameters (unless used in an old-style function definition)
However, when calling a function, you cannot include the void
keyword: int p = func(void);
won't compile - you have to use int p = func();
.