C/C++: Why doesn't int main() cause an error when I provide command line arguments?
So, obviously every C/C++ program needs a function int main() as an "entry point" for the OS. It can either be declared like this: int main() // no parameters {...} or like this: int main(int argc, char *argv[]) // parameters for command line arguments {...} The funny thing is that I can call both int main() WITH command line arguments (that will just be ignored) and int main(int argc, char *argv[]) WITHOUT command line arguments. I can even define int main(void) and explicitly tell the compiler that the main function doesn't accept any parameters and it'll still work without any problems if I provide command line arguments. How is that possible? If I declare a function int my_function(int, char*) and try to call it without providing exactly one int and one char* argument, there will be an error. In the same way, I can't declare a function int my_function(void) and call it with one or more arguments...