I was reading and it came to my attention that was told that each program should contain function called specifically "main". Is it really needed that it should be called "main" and not some other else name?... Im just curious because i came across to have a source code for a game and i was looking around the programs it has and didnt see the exact word "main" obviously it was using another name. Im not an advance programmer it just came to my mind does most of the advance c++ programmers uses their own name for the function main?
a C++ program always starts by calling main. Main is the only function called automatically, and the code in any other function is only executed if its function is called from main.
I was able to get hold of a game source and i was looking for main and couldnt find it but i guess it was too advance for me to understand why its not there, i will continue reading and try to get more references and experience on coding a single program so i will be able to understand :)
The linker provides a way to indicate that a particular function is the one to receive control when the a program is started. This is not your main() function. The C++ run time provides the function that receives control when you execute your program. It is the responsibility of this function to initialize the heap, open standard file, initialize global objects, etc. This function then passes control to explicity main(). This is dictated by the C++ standard.
To clarify coder777's response somewhat, you must call your function main() unless you are using a library that provides the main() function for you. Such a library will generally expect you to provide a function by a particular name that is called when the library initialization is complete.