## 的作用是把前后两个 token 连接起来。
eg: #define f(a,b) a##b
# 的作用是把后边的 token 变成字符串。
eg: #define s(a) #a
注意:## 连接前后两个数字的时候表现正常,但连接两个字符串时,在 GCC 下编译出错,则把 ## 用空格代替就好。
eg: #define f(a,b) (a b)
#include<stdio.h>
#define f1(a,b) a##b
#define f2(a,b) (a b)
#define g(a) #a
#define h(a) g(a)
int main()
{
// ## 和 # 不能直接嵌套
printf("h(f1(1,2)) = %s\n", h(f1(1,2))); // h(1##2) => h(12) => g(12) => "12"
printf("g(f1(1,2)) = %s\n", g(f1(1, 2))); // g(f1(1,2)) => "f1(1,2)"
printf("h(f2(1,2)) = %s\n", h(f1(1,2))); // h(1##2) => h(12) => g(12) => "12"
printf("g(f2(1,2)) = %s\n", g(f1(1, 2))); // g(f1(1,2)) => "f1(1,2)"
char *str = f2("abc", "def"); // 用 f1 将编译出错
printf("%s\n", str);
return 0;
}