What is useful about this C
syntax — using \'K&R\' style function declarations?
int func (p, p2)
void* p;
int p2;
{
return 0;
}
This is pretty old K&R C syntax (pre-dates ANSI/ISO C). Nowadays, you should not use it anymore (as you have already noticed its major disadvantage: the compiler won't check the types of arguments for you). The argument type actually defaults to int
in your example.
At the time, this syntax was used, one sometimes would find functions like
foo(p, q)
{
return q + p;
}
which was actually a valid definition, as the types for foo
, p
, and q
default to int
.