In Java, a function that takes no arguments is
expressed using ()
. In C,
such a function should be expressed with (void)
in its declaration and definition. However, it is still
invoked with ()
:
/* prototype/declaration */ int myfunc(void); /* definition */ int myfunc(void) { /* ... */ } /* invocation */ myfunc();
The form ()
is permitted
in declarations, but it means ‘unspecified arguments’
rather than ‘no arguments’. This tells the compiler to
abandon type-checking of arguments where that function is
invoked. It comes from an obsolete pre-standard version
of C, and is not recommended.