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

Add Two Numbers Without Using the Addition Operator

361


What is static memory allocation?

613


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2128


What is signed and unsigned?

651


What is difference between structure and union with example?

605






What are the characteristics of arrays in c?

622


Write a program to identify if a given binary tree is balanced or not.

695


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1482


How do you define a function?

595


What is data types?

647


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

1911


Explain what are reserved words?

646


Why is c called "mother" language?

872


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

716


Explain what is the purpose of "extern" keyword in a function declaration?

633