why the execution starts from main function

Answer Posted / ravi joshi

As many of them have answered here, main is a special
function in C/C++ programs. The compiler does not care if
you have defined main or not, but linker does. If linker
finds main defined in the objects being linked, then the
address of main function is placed at the top of execution
stack. And automatically when loader loads the
program/process, the main function gets loaded at the top of
execution stack, and system starts execution using
__crtmain() which internally calls main() of the program/process

Is This Answer Correct ?    16 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a 'null pointer assignment' error?

934


Write a program to implement queue.

862


What are the header files used in c language?

772


What is the explanation for modular programming?

896


Tell me about low level programming languages.

857


Are there namespaces in c?

773


How can this be legal c?

826


i got 75% in all semester am i eligible for your company

1935


How do I send escape sequences to control a terminal or other device?

813


Explain what is the difference between a string and an array?

878


What is echo in c programming?

733


Write a program to print fibonacci series using recursion?

813


What is a scope resolution operator in c?

937


State two uses of pointers in C?

811


Write the control statements in C language

853