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

What is the difference between CLEAR & RESET and OPEN & CLOSE OPCOEDS(USING RPG/400).wheare we can use this?can any body tell me in real time senario with example please?

0 Answers  


what are wrapper classes

2 Answers  


I want Ada programming language books. Could anyone post me any link for that?

0 Answers  


What is meant by SQL,PL/SQL,SQL PLUS? Is there any differnece between them?

2 Answers   HSBC,


what is the difference between an OS(operating system) and Framework?

0 Answers  






What do you mean by an array ? explain with an example

7 Answers  


Number of null pointers in any binary tree

5 Answers   Infosys,


What is the language used for Artificial Intelligence?

1 Answers  


what are all the validation we need to perform in data stage?

0 Answers  


how to write the fallowing code in java? 1 4 9 16 25 36 49 64 81 100

1 Answers  


Please forward important interview and basic questions in VB6 on my email id: usneha_16@yahoo.co.in

0 Answers  


differenc between visual studio 2005,2008 & 2010?

2 Answers  


Categories