In C, the declaration int f(void)
means a function returning int that takes no parameters. The declaration int f()
means a function returning int that takes any number of parameters. Thus, if you have a function that takes no parameters in C, the former is the correct prototype.
In C++, I believe int f(void)
is deprecated, and int f()
is preferred, as it specifically means a function that takes no parameters.