The C standard allows these 2 signatures for the main function:
int main (void);
int main (int argc, char* argv[]);
It also specifies that:
The parameters argc and argv and the strings pointed to by the argv array shall be modifiable by the program, and retain their last-stored values between program startup and program termination.
I am surprised by that choice. I think it would have been more natural to make argc
and argv
const
. It is often regarded as bad practice to modify these variables.
Am I missing something? Why has that choice been made?