InPikesyntaxissimilartothatofCandC++. Theexecutionbeginsatmain. The "argc" variablekeepsthenumberofargumentspassedtotheprogram. The "argv" variableholdsthevalueassociatedwiththeargumentspassedtotheprogram.
Example:intmain(intargc, array(string) argv)
Python
InPythonafunctioncalledmaindoesn'thaveanyspecialsignificance. However, itiscommonpracticetoorganizeaprogram'smainfunctionalityinafunctioncalledmainandcallitwithcodesimilartothefollowing:defmain(): # themaincodegoeshere
if __name__="__main__":main()WhenaPythonprogramisexecuteddirectly (asopposedtobeingimportedfromanotherprogram), thespecialglobalvariable__name__hasthevalue "__main__". [ [http://www.artima.com/weblogs/viewpost.jsp?thread=4829Pythonmain()functions] ]
Main function — See also: Entry point 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… … Wikipedia
Main (disambiguation) — Main may refer to any of the following: * The Main, a river in Germany * The Main, a river in Far Eastern Siberia. * Main River (Newfoundland), a river in Newfoundland, Canada * Spanish Main, a name given to the Caribbean coast * Main Street, a… … Wikipedia
Main — For the Wikipedia website front page, see Main Page. For the Wikipedia main namespace, see Help:Namespace. Main may refer to: Main (river), a major river and tributary of the Rhine in Germany Main River (Chukotka), a river in Far Eastern Siberia… … Wikipedia
Programming language — lists Alphabetical Categorical Chronological Generational A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that… … Wikipedia
Programming language theory — (commonly known as PLT) is a branch of computer science that deals with the design, implementation, analysis, characterization, and classification of programming languages and programming language features. It is a multi disciplinary field, both… … Wikipedia
Function object — A function object, also called a functor or functional, is a computer programming construct allowing an object to be invoked or called as if it were an ordinary function, usually with the same syntax.Function objects are unrelated to functors in… … Wikipedia
Function overloading — or method overloading is a feature found in various programming languages such as Ada, C#, VB.NET, C++, D and Java that allows the creation of several methods with the same name which differ from each other in terms of the type of the input and… … Wikipedia
Programming style — is a set of rules or guidelines used when writing the source code for a computer program. It is often claimed that following a particular programming style will help programmers to read and understand source code conforming to the style, and help … Wikipedia
Function (mathematics) — f(x) redirects here. For the band, see f(x) (band). Graph of example function, In mathematics, a function associates one quantity, the a … Wikipedia