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

后端 未结 5 1029
[愿得一人]
[愿得一人] 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:23

    int main(void)
    

    Under some OS (for example, Windows) also such is valid:

    int main(int argc, char **argv, char **envp)
    

    where envp gives an environment, otherwise accessible through getenv()

提交回复
热议问题