In C, how is the main() method initially called?

后端 未结 7 2038
甜味超标
甜味超标 2020-12-07 09:04

How does a C program get started?

7条回答
  •  囚心锁ツ
    2020-12-07 09:33

    Eventually it is operating system. Usually there is some medium between real entry point and main function, this is inserted by compiler linker.

    Some details (related to Windows): There is header in PE file called IMAGE_OPTIONAL_HEADER which has the field AddressOfEntryPoint, which is in turn address of the first code byte in the file that will be executed.

提交回复
热议问题