The execution of a C language starts from the main function of this program and ends with the main function; but it should be noted that there are also special circumstances. If the exit function appears in the code, the program will be ended directly.
The operating environment of this tutorial: windows7 system, c99 version, Dell G3 computer.
The execution of a C language program always starts from the main function. In a C language source program, regardless of whether the main function is written at the front or back of the program, the execution of the program always starts from the main function and ends in the main function.
But it should be noted that there are also special cases. If the exit function appears in the code, the program will be ended directly.
Tutorial recommendation: "c language tutorial video"
Extended information:
A c program has and only one The main function can have several other functions in addition to the main function, and each function implements a specific operation.
In a C language source program, regardless of whether the main function is written in the front or back of the program, the execution of the program always starts from the main function and ends in the main function.
The main function, also known as the main function, is the starting point of program execution. Main is relative, just like the overtones of phonetic theory, which are other functions in the program except main. It is a model that is generated to cater to people's way of thinking, rather than a certain one. There are primary and secondary functions, and the execution is clear and logical, which not only modularizes the program but also creates a closed whole.
Program execution always starts from the main function. If there are other functions, it will return to the main function after completing the calls to other functions. Finally, the main function ends the entire program. When the program is executed, the main function is called by the system. The main function is called after initialization of non-local objects with static storage duration is completed during program startup. It is the designated entry point for a program in a hosted environment (that is, an operating system). Entry points for stand-alone programs (boot loaders, operating system kernels, etc.) are implementation-defined.
For more programming related knowledge, please visit: Programming Video! !
The above is the detailed content of Where does the c language program start execution?. For more information, please follow other related articles on the PHP Chinese website!