Man, that comic is old. Make sure you guys get the
patch to bring it up to version 1.0.1.
There are two legal ways to define the main() function in C:
int main(void) - ignoring command-line arguments
int main(int argc, char *argv[]) - argc is number of command line arguments (counting the program name, which is argv[0]), argv is an array of the arguments themselves
The default return value is int, so these are identical:
int main(void)
main(void)
The default parameter list is void, so these are identical:
int main(void)
int main()
main()
I prefer to write (void) instead of () because although they're identical in a function definition, in a function declaration, () means something different. In particular,
int dosomestuff();
and
int dosomestuff(void);
might seem to be identical, but the first one actually tells the compiler not to check the parameters. That is, if you later call
dosomestuff(i, j, "!@#");
it won't be able to diagnose that you gave the function three arguments it doesn't need. With the second declaration of dosomestuff, it can tell you exactly where you messed up.