why main() method should not return any value

Answers were Sorted based on User's Feedback



why main() method should not return any value..

Answer / nadeem khokhar

execution starts from the main function. no function can call it, which means no function can save the returned value from main. then why should we take its return type as we can not use that any where! i do agree to jhill123 that in C we write int main instead of void main, it is used for exception handling.

Is This Answer Correct ?    4 Yes 2 No

why main() method should not return any value..

Answer / jhil123

It is possible if we declare main() function return value
as void. This is because the default return value of main
function in C is int and if one declares it as void it
results in mismatch in declaration and so cannot be
declared as void.

Is This Answer Correct ?    6 Yes 7 No

Post New Answer

More Programming Languages AllOther Interview Questions

How to print No.of.rows affected after updation using ADO.Net

0 Answers   Tech Mahindra,


What is nocopy in plsql?

1 Answers   IBA Health,


What is the difference between DECISION COVERAGE(DC) and MODIFIED CONDITION/DECISION COVERAGE(MCDC)?

0 Answers  


what is woransient key word? how it is used in java

0 Answers   Convergys,


when will triggars the at new event in abap and web dybn pro?

0 Answers   TCS,






how to hide prompts

0 Answers  


Is anyone has done the ASP.NET MVC4 workshop course(2 days) from Peers Technologies. Let me know. I need to talk before joining ASP.NET MVC4 training at peers, Hyderabad.

0 Answers  


Is class is a abstract datatype in java?

0 Answers  


what is web configuration file

0 Answers   HCL,


What is the entry point function of a DLL?

0 Answers   Wipro,


Hello Experts, What is the difference between move and move corresponding exactly? please post me asap

0 Answers  


what is the filters in biztakk server? where it can use?

0 Answers   Wipro,


Categories