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

Define Form modules, Class modules and Standard modules

0 Answers   Global Hunt,


write a program on c(or)c++(or)java language i.e if i have 5 numbers like (10,24,3,9,15) i want to display highest number from these numbers

2 Answers  


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

7 Answers  


What is a dialog based program

1 Answers  


what do u mean by tagging

0 Answers  


Write a program to create a process in UNIX

0 Answers  


differenc between visual studio 2005,2008 & 2010?

2 Answers  


Artficial language is provided which of the language?

3 Answers   Geometric Software,


how to data grid use in data bind?

0 Answers   HCL,


Which tag is used to break a line

3 Answers  


what is adodb??y it is used for connection of V.B and access??what is ado?dao?

0 Answers   TCS,


What is Negative testing?

0 Answers  


Categories