C语言宏定义时#(井号)和##(双井号)作用

#的功能是将其后面的宏参数进行字符串化操作(Stringfication),简单说就是在对它所引用的宏变量 通过替换后在其左右各加上一个双引号。
#define example(instr) printf("the input string is: %s ",#instr)
#define example1(instr) #instr
当使用该宏定义时:
example(abc); 在编译时将会展开成:printf("the input string is: %s ","abc");
string str=example1(abc); 将会展成:string str="abc";
而##被称为连接符(concatenator),用来将两个Token连接为一个Token。
原文地址:https://www.cnblogs.com/elesos/p/6867307.html