Is a main() required for a C program?

后端 未结 7 453
后悔当初
后悔当初 2020-12-15 03:13

Well the title says it all. Is a main() function absolutely essential for a C program?

I am asking this because I was looking at the Linux kernel code,

7条回答
  •  無奈伤痛
    2020-12-15 03:57

    Paxdiablo's answer covers two of the cases where you won't encounter a main. Let me add a couple of more:

    • Many plug-in systems for other programs (like, say, browsers or text editors or the like) have no main().
    • Windows programs written in C have no main(). (They have a WinMain() instead.)

提交回复
热议问题