1-const.cpp
#include <iostream>
using namespace std;
void f()
{
#define b 100
const int c = 200;
}
int main()
{
const int a = 1; //C++中,const修饰的是常量,存放在符号表中
//a++;
int *p = (int *)&a; //对const修饰的常量取地址,编译器分配了一个整形的长度,并且把数字1填写到对应的内存
*p = 2;
cout << a << endl; //因为a是常量,所以用1替换a
cout << b << endl; //作用域不同
//cout << c << endl;
return 0;
}
2-引用.cpp
#include <iostream>
using namespace std;
void swap(int &x, int &y)