An entry point is a program location where execution of a function or other callable unit begins. In a C program, main is the entry point that connects the runtime system to the application. section 7.0 section 7.2
The C entry point
A portable C program implements one of two standard forms: int main(void); or int main(int argc, char* argv[argc+1]);. The prototype is prescribed by the C standard, but the function body is supplied by the programmer. Returning EXIT_SUCCESS or EXIT_FAILURE communicates execution status to the runtime system. Reaching the closing brace of main is equivalent to returning EXIT_SUCCESS. section 7.2
Important consequences follow from main's special role:
- Use EXIT_SUCCESS and EXIT_FAILURE when returning from main; these are the status values guaranteed to work across platforms. section 7.2
- Treat exit(s) as equivalent to evaluating return s in main: it terminates the program and never returns to its caller. section 7.2
- Do not rely on platform-specific alternatives such as a void return type or an additional environment parameter when portability matters. section 7.2
Entry points below the C level
Assembler identifies fgoto with a label such as fgoto:, marking the machine-level entry point of that function. The surrounding instructions establish its stack frame and local storage before its translated body runs. section 13.5
int main(void);
int main(int argc, char* argv[argc+1]);
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":3}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":3}],[{\"line\":0,\"ch\":4},{\"line\":0,\"ch\":8}],[{\"line\":1,\"ch\":4},{\"line\":1,\"ch\":8}],[{\"line\":0,\"ch\":9},{\"line\":0,\"ch\":13}],[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":3}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":3}],[{\"line\":0,\"ch\":4},{\"line\":0,\"ch\":8}],[{\"line\":1,\"ch\":4},{\"line\":1,\"ch\":8}],[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":3}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":3}],[{\"line\":1,\"ch\":19},{\"line\":1,\"ch\":23}]]"}
!@%STYLE%@!
Compare the two standard main prototypes directly, including the command-line argument form. section 7.2









