C语言中#和##的作用

使用#把宏参数变为一个字符串,用##把两个宏参数贴合在一起. 

#include <stdio.h>


#define STR1(x) #x//使x成为字符串
#define STR2(x, y) int(x##e##y)//将x、e、y连接成字符串

int main()
{
    printf(STR1(1));
    putchar(10);
    printf("%d", STR2(3, 2));
    return 0;
}

运行结果:

原文地址:https://www.cnblogs.com/SimonKly/p/7542483.html