为什么不好在C ++中键入void main() [英] Why is it bad to type void main() in C++
本文介绍了为什么不好在C ++中键入void main()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
void main和int main之间的区别?
Possible Duplicate:
Difference between void main and int main?
为什么
void main() {
//return void
}
不好?
指出我这样做是错误的。我很困惑。我一直写这样一段时间,我知道它不是C ++标准,但编译器不会发出任何警告。为什么会出错?
The other day I typed this and someone pointed out to me that it is wrong to do so. I was so confused. I have been writing like this for a while now, I know it isn't C++ standard, but the compiler doesn't give out any warnings. Why is this wrong?
推荐答案
因为你使用的编译器没有错误,所以并不意味着其他编译器't。你知道它不是标准,毕竟...
Because the compiler you use does not error out on it, it doesn't mean other compilers won't. You know its not standard, after all...
这篇关于为什么不好在C ++中键入void main()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文