void main和int main之间的区别? [英] Difference between void main and int main?

查看:267
本文介绍了void main和int main之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我声明我的C ++程序是什么方式?

解决方案

区别是一个正确的方法来定义 main

 <$ c $ 

c> int main(int argc,char ** argv)

  int main()

是你的 main 的正确定义。



void main argc,char ** argv)



是不是和是的,IIRC,微软的C ++编译器的一个变态。



https://isocpp.org/wiki / faq / newbie#main-returns-int


Does it matter which way I declare my C++ programs?

解决方案

The difference is one is the correct way to define main, and the other is not.

And yes, it does matter.

int main(int argc, char** argv)

or

int main()

is the proper definition of your main per the C++ spec.

void main(int argc, char** argv)

is not and was, IIRC, a perversity that came with Microsoft's C++ compiler.

https://isocpp.org/wiki/faq/newbie#main-returns-int

这篇关于void main和int main之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆