main() in C, C++, Java, C#

前端 未结 9 1505
心在旅途
心在旅途 2020-12-11 06:20

Is main() (or Main()) in C, C++, Java or C#, a user-defined function or a built-in function?

9条回答
  •  我在风中等你
    2020-12-11 06:35

    It is not "built-in" in any language, in a sense that there is no standard implemented-for you main() avialable.

    For C/C++/Java, it is a function with a special property, namely, the function that will be called at the start of your program after all the static setup is done. E.g. entire C program's execution path is:

    1. Do some initialization code

    2. Call main()

    3. Exit.

    As such, it has a standard declaration (# of parameters passed from command line + array of "strings" - however the language implements that - which are the actual arguments from command line)

提交回复
热议问题