Main函数

  1. Mian函数是程序的入口,一个程序只有一个Mian函数。
  2. Mian函数是唯一被操作系统显示调用的函数。
  3. Mian函数的返回值必须是int类型,通常0代表执行成功。非0代表操作系统的其它定义,如错误。
  4. Mian函数可带参数,也可不带参数。
  5. //不带参数
    int mian()
    {
    ...
    }
    
    //带参数
    int main(int argc, char* argv[])
    {
    //argc : 字符串个数
    //argv : C风格字符串
    }
    
    或者
    int mian(int argc, char** argv)
    {
    ...
    }

posted on 2015-08-22 11:19  萨尔  阅读(212)  评论(0编辑  收藏  举报

导航