我第一次看到字符串化和令牌粘贴。我觉得它可能是这个宏的好工具:
#define MY_NUMBER 3
#define MY_STRING "the number three: ##MY_NUMBER"
printf("%s\n", MY_STRING);
应输出:
the number three: 3
答案 0 :(得分:2)
试试这个
#define S_(x) #x
#define S(x) S_(x)
#define MY_NUMBER 3
#define MY_STRING "the number three: " S(MY_NUMBER)