In many programming languages, the main function is where a program starts execution. It is responsible for the high-level organization of the program's functionality, and typically has access to the command arguments given to the program when it was executed. Thus main is very important to run your code.
The main function is generally the first programmer-written function run when a program starts, and is invoked directly from the system-specific initialization contained in crt0 or equivalent. However, some languages can execute user-written functions before main runs, such as the constructors of C++ global objects.
Famous quotes containing the words main and/or function:
“In most books, the I, or first person, is omitted; in this it will be retained; that, in respect to egotism, is the main difference.”
—Henry David Thoreau (18171862)
“For me being a poet is a job rather than an activity. I feel I have a function in society, neither more nor less meaningful than any other simple job. I feel it is part of my work to make poetry more accessible to people who have had their rights withdrawn from them.”
—Jeni Couzyn (b. 1942)