Just wondering why this
int main(void){}
compiles and links
and so does this:
int main(int argc, char **argv){}
The short answer: if you don't use the parameters, then you can declare main without parameters, in two ways:
int main(void)
or
int main()
The first means main
is a function with no parameters. The second means main
is a function with any number of parameters.
Since you don't access the parameters, both will be fine. Any compiler having "special" code to check the parameters of main
is wrong. (But: main
must return a value.)