By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,433 Members | 1,643 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,433 IT Pros & Developers. It's quick & easy.

Purpose of void in function main()

P: 4
Please tell me what is the purpose of void in function main.
Nov 17 '08 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 2,415
Please elaborate. Are you talking about "void" appearing in the function prototype for 'main'? If so, please show us the function prototype in question.
Nov 17 '08 #2

Ganon11
Expert 2.5K+
P: 3,652
If you are referring to:

Expand|Select|Wrap|Line Numbers
  1. void main()
then you should know that this is not a supported method of declaring main. You should instead write:

Expand|Select|Wrap|Line Numbers
  1. int main()
and return 0; at the end of main().
Nov 17 '08 #3

weaknessforcats
Expert Mod 5K+
P: 9,197
Yes, that
Expand|Select|Wrap|Line Numbers
  1. void main()
  2.  
is a Microsoft whiz-bang they have been trying to undo ever since they brought it up. Unfortunately, there are many MSDN examples that show this and MS does not see this as a priority fix so the myth lives on.

main() returns an int.
Nov 18 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.