The main function is a special function in C, and the C program is always executed from the main function, and the prototype of the main function is:
1 int Main (intchar *argv[]);
Where ARGC is the number of command-line arguments, argv is an array of pointers to the parameters.
When the kernel executes a C program (using an EXEC function), a special startup routine is called before calling main (what ghost?). )。 Executable files Specify this startup routine as the starting address of the program-this is set by the connection editor, and the connection editor is called by the C compiler. The start routine takes command-line arguments and environment variable values from the kernel, and then arranges for calling the main function as described above.
The approximate process is as follows:
http://blog.csdn.net/sxh741/article/details/54970085 This link is pretty clear.
Http://www.cnblogs.com/findumars/p/6417932.html is about what the C + + main function does before it executes.
1, first to see a simple C program (SIMPLE.C) as an example to explain
2. Compiling
Gcc-o Simple simple.c
3. View the basic information of the executable file
Objdump-f Simple
4. What is Elf
5, about the starting address
The main function in C and how the main function is called