What are the valid signatures for C's main() function?

后端 未结 5 1020
[愿得一人]
[愿得一人] 2020-11-22 05:05

What really are the valid signatures for main function in C? I know:

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

Are there other valid ones?

5条回答
  •  时光取名叫无心
    2020-11-22 05:31

    http://en.wikipedia.org/wiki/Main_function_(programming)#C_and_C.2B.2B

    Besides the usual int main(int argc, char *argv[]) and the POSIX int main(int argc, char **argv, char **envp), on Mac OS X also supports

    int main(int argc, char* argv[], char* envp[], char* apple[]);
    

    Of course it's Mac-only.

    On Windows there's

    int wmain(int argc, wchar_t* argv[], wchar_t* envp[]);
    

    as the Unicode (actually, wide-character) variant. Of course there is WinMain too.

提交回复
热议问题