1. C++会对函数返回值类型和参数个数进行检测
c语言默认为返回值为int, 参数个数不做检查
2. C++在定义结构体变量时, 关键字struct可以省略, 结构体名不能省
3. 在全局中定义:
int val_g; //bss段(全是0), 在全局中
int val_g = 20; //data
c正确(2是赋值)
c++错误(重定义)
4. 命名空间(只能写在全局)
①. using namespace std;(方便不精确)
②. using std::cout;
using std::endl;(方便, 重名时不精确)
std::cout; std::endl; (不方便, 但重名时精确)
对常量引用, 必须加const修饰, 如: const int &a = 10;
防止通过引用对常量进行修改
再如:const int a = 10;
const int &re = a;