why the execution starts from main function
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / vignesh1988i
it is the first function to be called or to be executed in
the code of the compiler.......
thank u
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / vignesh1988i
their will be a program written for creating a
compiler..... so in that main() may be a first function call
for that coding written in compiler
thank u
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / rahat
main is a special inbuilt function which is used to start
the execution of the program,and the compiler searches for
this function to start the execution of the program.
| Is This Answer Correct ? | 6 Yes | 2 No |
Answer / vamsi
the main function receives command line arguments and so if
v pass any command line arguments as in put they have to b
taken and executed for this reason the execution starts from
main
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / vrushali
The c run time system inserts some start up code before the
main function and inserts some clean up code at the end of
the program .
The operating system loads the executable of the program in
to the memory with the help of the loader and transfers the
control to theprogram .
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / vrushali
If the execution of a program is required to start from a
test program e.g test (). Then we are required to change the
linker itself. As there a default program which searches for
main .
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / rambo
in general _startup is handler for reset vector(0xffff in
freescale) _startup function calls main function.
if u replace main() with ur own function then the system
call ur function.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / abhradeep chatterjee
when c compiler searches for the beginning of the program,
then it looks for the main function.
| Is This Answer Correct ? | 2 Yes | 4 No |
List out few of the applications that make use of Multilinked Structures?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { char c; struct xx* p; } struct yy* q; }
How do you define CONSTANT in C?
What is keyword in c?
what is the answer for it main() { int i; clrscr(); printf("%d",&i)+1; scanf("%d",i)-1; }
Is this program statement valid? INT = 10.50;
Write a program for the following series? 1 121 12321 1234321 123454321 12345654321 1234567654321 123456787654321 12345678987654321 1234567890987654321 123456789010987654321 12345678901210987654321 1234567890123210987654321 .........1234321............ ..........123454321............ ..........12345654321............ 7 8 9 0 1 Pls............?
Why main is not a keyword in c?
WAP that prints the number from 1 to 100. but for multiplies of three print "XXX" instead of the number and for the multiplies of five print "YYY" . for number which are multiplies of both three and five print "ZZZ"
Why can't we initialise member variable of a strucutre
why i join syntel?
23 Answers ABC, Syntel, TCS,