ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
why the execution starts from main function
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: why the execution starts from main function
Answer
# 1
it is the first function to be called or to be executed  in
the code of  the compiler.......



thank u
 
Is This Answer Correct ?    4 Yes 0 No
Vignesh1988i
 
  Re: why the execution starts from main function
Answer
# 2
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 ?    2 Yes 0 No
Vignesh1988i
 
 
 
  Re: why the execution starts from main function
Answer
# 3
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 ?    1 Yes 0 No
Vamsi
 
  Re: why the execution starts from main function
Answer
# 4
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 ?    1 Yes 1 No
Vrushali
 
  Re: why the execution starts from main function
Answer
# 5
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 ?    2 Yes 0 No
Rahat
 
  Re: why the execution starts from main function
Answer
# 6
when c compiler searches for the beginning of the program, 
then it looks for the main function.
 
Is This Answer Correct ?    0 Yes 0 No
Abhradeep Chatterjee
 
  Re: why the execution starts from main function
Answer
# 7
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
Vrushali
 
  Re: why the execution starts from main function
Answer
# 8
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 ?    1 Yes 0 No
Ravi Joshi
 
  Re: why the execution starts from main function
Answer
# 9
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 0 No
Rambo
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
wap in c to accept a number display the total count of digit  4
#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared like DCHAR ch1, ch2; TCHAR ch3, ch4; then what will be types of ch1, ch2, ch3 and ch4? NDS1
Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Quick Sort 2) Bubble Sort 3) Merge Sort  5
WHY DO WE USE A TERMINATOR IN C LANGUAGE?  2
C,c++, Java is all are structural oriented or procedure oriented language..?  3
difference between my-strcpy and strcpy ? Geometric-Software3
size maximum allocated by calloc() DELL1
Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { char c; struct xx* p; } struct yy* q; } NDS3
program to find middle element of linklist? Huawei1
Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa.  1
Write a program to interchange two variables without using the third variable? Accenture11
How can draw a box in cprogram without using graphics.h header file & using only one printf(); ? NIIT1
Predict the output or error(s) for the following: 25. main() { printf("%p",main); } ME3
Why preprocessor should come before source code?  2
what is the output of the following program? #include<stdio.h> void main() { int x=4,y=3,z; z=x-- -y; printf("\n%d %d %d",x,y,z); }  10
whether itis a structured language? Microsoft1
In the following code segment what will be the result of the function, value of x , value of y { unsigned int x=-1; int y; y = ~0; if(x == y) printf("same"); else printf("not same"); } a) same, MAXINT, -1 b) not same, MAXINT, -MAXINT c) same , MAXUNIT, -1 d) same, MAXUNIT, MAXUNIT e) not same, MAXINT, MAXUNIT IBM1
How can I make a program in c to print 'Hello' without using semicolon in the code? C-DAC5
Write a C program to print 1 2 3 ... 100 without using loops?  5
what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf("%d",*c); ++q; } for(j=0;j<5;j++) { printf("%d",*p); ++p; } }  4
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com