how is foo(void) different from foo() ?
how is foo(void) different from foo() ?
foo() is unspecified number of arguments, foo(void) is no arguments. In declarations, at least.
If you are referring to C (I will assume so..):
foo() is a call to the function "foo" with no arguments.
<type> foo(void) is the proper way to declare/define a function that takes no arguments.
<type> foo(...) is partly the way to declare/define a function that takes a variable number arguments. Keep in mind though that there must always be at least one argument in a variadic function, so
<type> foo(<type>, ...) is at least necessary.
Last edited by @nthony; 06-18-2007 at 05:30 PM.