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

why we use new keyword for object

4 Answers   TCS,


what are the missinschema properties and should we pass primary key in select command

0 Answers  


what is oops?

4 Answers   Satyam,


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

0 Answers  


what is the meaning of without standing arrears?

0 Answers   TCS,


What is the language used for Artificial Intelligence?

1 Answers  


what is client server & server? What r types of Joins? explsin it! which types of indexex in sql server? what is triggers?

0 Answers  


diffrence between oracle apps , .NET , SAP

0 Answers  


Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming

1 Answers  


can we extend a class having only one parameterised constructor.Suggest the process to do it.

0 Answers   Zensar,


1. Consider the following code in our example assembly language: ; an example bit of assembly code ROOT: W FATHER FATHER: W SON1 W SON2 SON1: W NIL W NIL ; ---------------------- SON2: W GRANDSON W NIL GRANDSON: W NIL W NIL NIL = 0 Assemble this code carefully following the two pass model, and show the symbol table at the point marked by the dashed line during each pass.

0 Answers   TCS,


What is the effect of the OPTIONS statement ERRORS=1?

3 Answers   QSG, Quintiles, SAS,


Categories