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

Info for guidewire documents and interview questions

1 Answers  


How can we develop a multi-tier application in Java?

0 Answers  


code for connection from windows forms to sql server

0 Answers   ME,


Difference between abstract class and Interfaces in Java

9 Answers   Nest, Persistent, Yantro Software,


what is the similarity between networking devices?

0 Answers   Cygnus, Infosys,






how sap is different from other software ?

0 Answers  


What is the use of Differ interface check box in Ship confirm?

0 Answers  


Even if all fields are initialized also in a program, I am getting COBOL/400 decimal data error .why is it coming?

1 Answers   Freelance,


what is the diff bw sql direct and jdbc update can't we do select and updating operation in sql direct

0 Answers   HP,


How to display questions one by one in jsp and I wants to store the answers in my database?

0 Answers  


What is the client concept in SAP? What is the meaning of client independent?

3 Answers  


What is a dialog based program

1 Answers  


Categories