Main Function

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:

    “And ye shall know the truth, and the truth shall make you free.”
    —Bible: New Testament John 8:32.

    These words of Jesus are inscribed on the wall of the main lobby at the CIA headquarters, Langley, Virginia.

    “The information links are like nerves that pervade and help to animate the human organism. The sensors and monitors are analogous to the human senses that put us in touch with the world. Data bases correspond to memory; the information processors perform the function of human reasoning and comprehension. Once the postmodern infrastructure is reasonably integrated, it will greatly exceed human intelligence in reach, acuity, capacity, and precision.”
    —Albert Borgman, U.S. educator, author. Crossing the Postmodern Divide, ch. 4, University of Chicago Press (1992)