Because it is not like the C syntax. Parameter declarations differ from variable declarations in several ways, for example
void fun(int i, double x);
vs.
int i, double x;
Although the syntax could be extended to allow the form you tried (which is allowed, for example, Go with its func fun(i, j, k int) , the standard committee decided not to do this, apparently because it would confusing in the face of old-style ("K & R", pre-1989), which is still supported in ANSI C89 / ISO C90 for backward compatibility.
void fun(i, j) // K&R syntax: implicitly int i, int j { } void fun(i, p) int *p; // int i implicit! { } // What this? double i? double *i? Mixed K&R/ANSI syntax with implicit int i? void fun(double *x, i) { }
source share