in c++ main function is the entry point to program how i can change it to an other function?

前端 未结 13 1900
忘了有多久
忘了有多久 2020-12-03 01:12

I was asked an interview question to change the entry point of a C or C++ program from main() to any other function. How is it possible?

13条回答
  •  醉话见心
    2020-12-03 01:38

    From C++ standard docs 3.6.1 Main Function,

    A program shall contain a global function called main, which is the designated start of the program. It is implementation-defined whether a program in a freestanding environment is required to define a main function.

    So, it does depend on your compiler/linker...

提交回复
热议问题