Click here to Skip to main content
15,041,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is reason to use only void in main method.
Any idea! please help me
Posted
Updated 11-Jan-11 4:48am
v2
Comments
Sergey Alexandrovich Kryukov 11-Jan-11 10:55am
   
This is not true.
MDNadeemAkhter 11-Jan-11 11:04am
   
What do you mean by not true. I used other return type except void all give error. Thats why i asked qtn here to know solution.
Аslam Iqbal 11-Jan-11 13:24pm
   
only int & void, no other types are allowed here.

1 solution

You can only use int or void in your Main Method
and to know more about it..
I will suggest you to take a look of expert answer which is given Here[^] in same(C.P) forum
I hope it will help you to remove your confusion about return type in Main Method.
   
v2
Comments
MDNadeemAkhter 11-Jan-11 11:08am
   
Thanks Ravi to remove my confusion. i got solution.
RaviRanjanKr 11-Jan-11 11:11am
   
you are always welcome.
Аslam Iqbal 11-Jan-11 13:22pm
   
I appreciate your answer but there is another 1 reason that is return statement is not needed when void is used. Which reduces 1 line of code of programmer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900