C++的疑问

来源:互联网 发布:c语言小游戏编程实例 编辑:程序博客网 时间:2024/05/17 04:44
有些规则其实照做就是,可是有时就钻了牛角想知道WHY,搞不清楚且似乎不是那么着急的疑问就先记在这里。

1、main函数的返回值
"The main function is required to have a return type of int, which is the type that represents integers. The int type is a built-in type, which means that the type is defined by the language. "-C++ Primer.v4

2、注释的位置
【规则 2 -7 -6 】注释的位置应与被描述的代码相邻 ,可以放在代码的上方或右方,不可放在下方
-高质量C++/C编程指南(作者:林锐 博士)

3、for循环里的 i++ 和 ++i
听说后者更好,but why ?