main 函数的写法

C99 文档
 Program startup

The called at program startup is named main.The implementation declares no

prototype for this .It shall be defined with a return type of int and with no

parameters:

int main(void) { /* ... */ }

or with twoparameters (referred to here as argc and argv,though anynames may be

used, as theyare local to the in which theyare declared):

int main(int argc, char *argv[]) { /* ... */ }

or equivalent;9)or in some other implementation-defined manner.

 从C99标准的规定里可以看出,main函数的标准定义一般为这两种形式:

        第一种形式:

        int main (void)

        {

               ……

               return 0;

        }

 

       第二种形式:

        int main (int argc, char *argv[ ])

        {

              ……

              return 0;

        }

你可能感兴趣的:(main 函数的写法)