search

Home  >  Q&A  >  body text

c++ - 求解C语言main函数

int main P2(int, argc, char **, argv)这个是什么意思?入口函数吗

巴扎黑巴扎黑2803 days ago543

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 15:27:44

    After searching, I found a similar question on stackoverflow: why main P2((ac, av), int ac, char ** av)?

    It probably means that P2 is a macro. This macro is for compatibility with older versions of compilers. For example, some early C languages ​​are not

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

    but

    main(ac,av)
    int ac;
    char **av;

    P2(int, argc, char **, argv)This macro will use different int main() forms depending on the compiler.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 15:27:44

    There is no such syntax in C. If it can be compiled like this, P2 should be a macro

    #define P2
    int main P2(int argc, char** argv) {
        return 0;
    }

    reply
    0
  • Cancelreply