In C, f
doesn't take "no arguments", but rather "any arguments"*. Say int f(void)
to declare "no arguments".
This is different from C++. Notably, C has separate notions of function "declaration" and function "prototype":
int f(); /* declaration -- f is still a mystery */
int f(int, double); /* prototype -- now we know how to call f */
int f(int n, double c) { return -1; } /* defintion -- now we can link */
*) As I said in the comment, "any arguments" is restricted to types that do not suffer default-promotion (in the same way as default-promotion happens to variadic arguments). That is, float
, all flavours of char
and of short int
, and also ...
, are not permissible in the actual function signature.