Which `main` is used if I specify more than one

Along with several others, prototypes are valid for main() :

  • int main(void)

  • int main(int, char**)

In C, we cannot overload functions, so there can never be either one or the other. But in C ++ this is not the case. If I had both in a compiled C ++ executable, which one is used? Does it depend on the command line? What does the standard say?

+6
source share
1 answer

C ++ 11 ยง3.6.1 / 2:

" This function should not be overloaded.

+18
source

Source: https://habr.com/ru/post/979714/


All Articles