#include <iostream>
#define t(x) hello##x//合并操作符##将出现在其左右的字符序列合并成一个新的标识符
#define s(y) #y//将传入的参数变为字符串,字符串化
using namespace std;
int main()
{
int hello1 = 10;
cout<<t(1)<<endl;//将hello和1链接形成hello1,hello1是一个变量
cout<<s(hello)<<endl;//将hello变为字符串
return 0;
}
整理自点击打开链接
点击打开链接