I believe in "older" C (I don’t know which version) foo()means "any parameters", while it foo(void)does not mean any parameters. foo()the version of any parameters is outdated. I believe in c99.
A quick googling search finds this wikipedia article mentioning a similar fact.
C ++ will accept foo(void), but it means the same as foo(), which means "no parameters."
So in C ++, the preferred way is to use foo().
source
share