C语言#和##的作用

#include <stdio.h>

#define CONNECT(ARG1,ARG2) ARG1##ARG2  //##起到连接的作用
#define STR(ARG) #ARG //#将参数转换为字符串

int main()
{
	printf("%s\n",CONNECT("hello","123"));//输出:hello123
	printf("%s\n",STR(haha));//输出:haha
	getchar();
	return 0;
}

猜你喜欢

转载自blog.csdn.net/csdn_gddf102384398/article/details/88785873