CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What is the purpose of main( ) function?
Category C Interview Questions
Rating (4.3) By 21 users
Added on 10/22/2004
Views 9813
Rate it!
Answers:

The function main( ) invokes other functions within it.It is the first function to be called when the program starts execution.

?It is the starting function

?It returns an int value to the environment that called the program

?Recursive call is allowed for main( ) also.

?It is a user-defined function

?Program execution ends when the closing brace of the function main( ) is reached.

?It has two arguments 1)argument count and 2) argument vector (represents strings passed).

?Any user-defined name can also be used as parameters for main( ) instead of argc and argv



main is function which must be needed in our program it does'n matter where you write your main function in your program but it will starts execution from main our program will compile without main but to RUN it we must need Main() function.Main() behave like a function its by default datatype is INT, thats why we cant define a function inside main() as we know that we cant define a function within a function we can only call a function from other function.when our program starts it first looks for main and than it starts its execution from so without main we cant RUN our program.



 Posted by: sunny chouhan    

Contact sunny chouhan  Contact sunny chouhan

Program execution always start with main().if u want to start the program execution we have to use main() function in our program.



 Posted by: Amol Patil    

Contact Amol Patil  Contact Amol Patil

main() fuction nessesary for execution of program and also it return the value of int ; and behave like a fuction



 Posted by: tarachand    

Contact tarachand  Contact tarachand

In our c program,every program starts with main() because it tells the c compilor where the program sarts its execution.it returnes always integer value.it is a well defined user defined function.it has two arguments argc and argv,argc is a integer type and argv is a char type pointer vector.



 Posted by: krishnachaitanya    

Contact krishnachaitanya  Contact krishnachaitanya


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What are the advantages of the functions?
View Answer
What is a method?
View Answer
What is a pointer value and address?
View Answer
What is a pointer variable?
View Answer
Are pointers integers?
View Answer
How are pointer variables initialized?
View Answer
What is static memory allocation and dynamic memory allocation?
View Answer
What is the purpose of realloc( )?
View Answer
Difference between arrays and pointers?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/969/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.69