c/c++宏定义,#,## 代码实例
- 作者: 久伴sxl
- 来源: 51数据库
- 2021-06-27
# —— 字符串
##——连接两个参数
#include <iostream>
using namespace std;
#define test(pid) (cout<<para##pid<<endl);
#define test2(p) (cout<<#p<<endl);
int main()
{
int para3 = 3;
int para2 = 2;
test(2); //<==>cout<<para2<<endl;
test(3); //<==>cout<<para3<<endl;
test2(test) //<==>cout<<"test"<<endl;
test2("test2"); //<==>cout<<""test2""<<endl;
system("pause");
return 0;
}
推荐阅读
