Possible Duplicate:
In C, how is the main() method initially called?
I want to know, who calls the main function in C.
What is actual use of the main function ( why main is special/necessary ) ?
Can I write a c program with out main function ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you ask your operating system to run a file, it loads it into memory, and jumps to it starting point (
_start,etc). At this point, there is an code, that callmainand then exit (The linker is responsible to this part). If you will write program withoutmainfunction, the linker will give you an error, since it couldn’t find it.